android - Andoid Databinding view tag isn't correct on view:null -
the question tag may familiar in stackoverflow have situation here. want achieve app have bottom menu bar visible across application. added view , set on base activity following
@override public void setcontentview(int layoutresid) { fulllayout = (relativelayout) getlayoutinflater().inflate(r.layout.activity_base, null); configuretoolbar(fulllayout); subactivitycontent = (framelayout) fulllayout.findviewbyid(r.id.content_frame); getlayoutinflater().inflate(layoutresid, subactivitycontent, true); super.setcontentview(fulllayout); } previously like:
@override public void setcontentview(int layoutresid) { view view = getlayoutinflater().inflate(layoutresid, null); configuretoolbar(view); super.setcontentview(view); } now on page there data-binding. called following:
viewmodel = new myviewmodel(someid, somename, false, emptystring); binding = databindingutil.setcontentview(this, r.layout.activity_my_layout); binding.setitem(viewmodel); now getting error on 2nd line.
here activity layouts. 1st 1 common layout activity_base, 2nd 1 data binding layout.
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_height="match_parent"> <include android:id="@+id/app_bar" layout="@layout/app_bar" /> <framelayout android:id="@+id/content_frame" android:layout_width="match_parent" android:layout_height="match_parent" /> <com.roughike.bottombar.bottombar android:id="@+id/bottombar" android:layout_width="match_parent" android:layout_height="60dp" android:layout_alignparentbottom="true" app:bb_tabxmlresource="@xml/bottombar_tabs" /> 2nd layout:
<layout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:map="http://schemas.android.com/apk/res-auto"> <data> <import type="android.view.view" /> <variable name="item" type="io.ppp.views.someactivity" /> </data> <relativelayout xmlns:tools="http://schemas.android.com/tools" android:id="@+id/root_view" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="io.ppp.views.someactivity"> <include android:id="@+id/app_bar" layout="@layout/app_bar" /> <!--<include layout="@layout/activity_base" />--> <webview xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/webviewloader" android:layout_width="fill_parent" android:layout_height="fill_parent" /> <relativelayout android:id="@+id/progress_indicator" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignparenttop="false" android:layout_centerinparent="true" android:visibility="@{item.loading ? view.visible : view.gone}"> <progressbar android:id="@+id/search_progress" style="@style/base.widget.appcompat.progressbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_alignparentstart="true" android:layout_alignparenttop="true" android:indeterminate="true" /> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerhorizontal="true" android:layout_gravity="center" android:layout_margintop="50dp" android:text="@{item.loadingtext}" android:textappearance="?android:attr/textappearancesmall" /> </relativelayout> </relativelayout>
i don't think solution implement bottom navigation bar across application since creating activities, , clear user every time change activity screen totally swap (bottom bar included) instead of keeping fixed element in bottom of screen user use guide himself across application.
implementing bottom navigation in android trickier in ios since going have work 1 single activity , fragments(lots of them if have lot of screens) achieve smooth bottom navigation application.
my advice transform activities fragments, implement bottom navigation activity bottom bar , fragment container, , go there.
from api 25 introduced bottomnavigationview make life easier , won't need use bottombar library github. advice @ ahbottomnavigation, seems me more complete native one, gives better control , choices on bottom bar.
Comments
Post a Comment