Ejemplo n.º 1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);// Get pager from layout
            ecPagerView = FindViewById <ECPagerView>(Resource.Id.ec_pager_element);

            // Generate example dataset
            IList <IECCardData> dataset = CardDataImpl.GenerateExampleData();

            var adapter = new DemoECPagerViewAdapter(this, dataset);

            adapter.HeadCardClicked += delegate {
                ecPagerView.Toggle();
            };
            ecPagerView.SetPagerViewAdapter(adapter);

            // Add background switcher to pager view
            ecPagerView.SetBackgroundSwitcherView(FindViewById <ECBackgroundSwitcherView>(Resource.Id.ec_bg_switcher_element));
        }
Ejemplo n.º 2
0
        public override void InstantiateCard(LayoutInflater p0, ViewGroup head, ListView list, IECCardData data)
        {
            // Data object for current card
            CardDataImpl cardData = (CardDataImpl)data;


            // Set adapter and items to current card content list
            list.Adapter = new CardListItemAdapter(head.Context, cardData.ListItems as List <string>);
            // Also some visual tuning can be done here
            list.SetBackgroundColor(Color.White);

            // Here we can create elements for head view or inflate layout from xml using inflater service
            TextView cardTitle = new TextView(head.Context);

            cardTitle.Text = cardData.CardTitle;
            cardTitle.SetTextSize(Android.Util.ComplexUnitType.Dip, 20);

            FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WrapContent, FrameLayout.LayoutParams.WrapContent);
            layoutParams.Gravity = GravityFlags.Center;
            head.AddView(cardTitle, layoutParams);

            head.Click -= Head_Click;
            head.Click += Head_Click;
        }