Esempio n. 1
0
        private void CreateCarousel(Carousel element)
        {
            //Create carousel
            var carousel = new SnappyRecyclerView(Xamarin.Forms.Forms.Context, SelectItemAction);

            //Setup layout options
            var frame  = element.Bounds;
            var width  = (int)Context.ToPixels(frame.Width);
            var height = (int)Context.ToPixels(frame.Height);

            carousel.LayoutParameters = new LayoutParams(width, height);

            //Set the custom adapter
            _adapter = new CarouselAdapter(element);
            carousel.SetAdapter(_adapter);

            //Set the custom layout manager
            _layoutManager = new SnappyLinearLayoutManager(Context);
            carousel.SetLayoutManager(_layoutManager);

            SetNativeControl(carousel);
        }
 public SnappySmoothScroller(Context context, SnappyLinearLayoutManager layoutManager)
     : base(context)
 {
     _layoutManager = new WeakReference <SnappyLinearLayoutManager>(layoutManager);
 }