コード例 #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);
        }
コード例 #2
0
 public SnappySmoothScroller(Context context, SnappyLinearLayoutManager layoutManager)
     : base(context)
 {
     _layoutManager = new WeakReference <SnappyLinearLayoutManager>(layoutManager);
 }