Example #1
0
        void CreateRecyclerView()
        {
            _recyclerView        = new ScrollRecyclerView(Android.App.Application.Context);
            _recyclerView.Touch += _recyclerView_Touch;
            var scrollListener = new GridViewScrollListener(Element, _recyclerView);

            _recyclerView.AddOnScrollListener(scrollListener);
            if (Element.IsHorizontal)
            {
                var linearLayoutManager = new LinearLayoutManager(Context, OrientationHelper.Horizontal, false);
                _layoutManager = linearLayoutManager;
            }
            else
            {
                var gridlayoutManager = new GridLayoutManager(Context, 1);

                _layoutManager = gridlayoutManager;
            }
            _recyclerView.SetLayoutManager(_layoutManager);
            _recyclerView.SetItemAnimator(null);
            _recyclerView.HasFixedSize = true;

            _recyclerView.HorizontalScrollBarEnabled = Element.IsHorizontal;
            _recyclerView.VerticalScrollBarEnabled   = !Element.IsHorizontal;

            _adapter = new GridViewAdapter(Element.ItemsSource, _recyclerView, Element, Resources.DisplayMetrics);

            _recyclerView.SetAdapter(_adapter);
            UpdatePadding();
        }
Example #2
0
 public GridViewScrollListener(GridView gridView, ScrollRecyclerView recyclerView)
 {
     _gridView     = gridView;
     _recyclerView = recyclerView;
 }