Android Databinding - How To Bind A Viewgroup's Properties
I am developing an Android app in Xamarin.Android(C#). However, i do feel that this question can also be answered by any Java devs as well. I am new in android development. Anyways
Solution 1:
Im not familiar with MVVMLIght extension but if you are using a fragment as it is supposed to (ie. in a tablayout) you should inherit from a fragment like this (This is a v4 support fragment):
publicclassCategoryFragment : SupportFragment {
RecyclerView _recyclerView;
private View _view;
publicoverride View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
_view = inflater.Inflate (Resource.Layout._CategoryLayout, container, false);
// Get our RecyclerView layout:
_recyclerView = _view.FindViewById<RecyclerView> (Resource.Id.categoryRecyclerView);
// Instantiate the layout managervar linearLayoutManager = new LinearLayoutManager (Context, LinearLayoutManager.Vertical, false);
_recyclerView.SetLayoutManager (linearLayoutManager);
// Instantiate the adapter and pass in its data source:
_adapter = new CategoryAdapter (_categories);
//Register the item click handler with the adapter:
_adapter.ItemClick += OnItemClick;
// Plug the adapter into the RecyclerView:
_recyclerView.SetAdapter (_adapter);
return _view;
}
}
Post a Comment for "Android Databinding - How To Bind A Viewgroup's Properties"