Forum Xamarin Xamarin.Android

how to use pagination in recyclerview ?

JanakSabhayaJanakSabhaya USMember ✭✭
edited December 2018 in Xamarin.Android

how to use pagination in recyclerview ?

public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
var view = base.OnCreateView(inflater, container, savedInstanceState);

    var recyclerView = view.FindViewById<RecyclerView>(Resource.Id.my_recycler_view);
        if (recyclerView != null)
        {
            recyclerView.HasFixedSize = true;

            var layoutManager = new LinearLayoutManager(Activity);

            var onScrollListener = new XamarinRecyclerViewOnScrollListener (layoutManager);
            onScrollListener.LoadMoreEvent += (object sender, EventArgs e) => {
                //Load more stuff here
            };

            recyclerView.AddOnScrollListener (onScrollListener);

            recyclerView.SetLayoutManager(layoutManager);
        }
        return view;
    }

Answers

Sign In or Register to comment.