コード例 #1
0
        public TermsAndPrivacyRenderer(Context context) : base(context)
        {
            mainActivity = (MainActivity)Context;

            _androidCoordinatorLayout = (CoordinatorLayout)mainActivity.LayoutInflater.Inflate(Resource.Layout.TermsAndPrivacy, null);

            _androidAppBarLayout = _androidCoordinatorLayout.FindViewById <AppBarLayout>(Resource.Id.termsAppBar);

            toolbar = _androidAppBarLayout.FindViewById <Toolbar>(Resource.Id.termsToolBar);

            mainActivity?.SetSupportActionBar(toolbar);
            ActionBar actionBar = mainActivity?.SupportActionBar;

            if (actionBar != null)
            {
                actionBar.SetDisplayHomeAsUpEnabled(true);
                actionBar.SetDisplayShowHomeEnabled(true);
                actionBar.SetDisplayShowTitleEnabled(false);
            }

            viewPager = _androidCoordinatorLayout.FindViewById <ViewPager>(Resource.Id.pager);

            tabLayout = _androidAppBarLayout.FindViewById <TabLayout>(Resource.Id.tabLayout1);
            tabLayout.SetupWithViewPager(viewPager);
        }
コード例 #2
0
        public HowToRenderer(Context context) : base(context)
        {
            mainActivity = Context as MainActivity;

            _androidLinearLayout = new LinearLayout(Context)
            {
                LayoutParameters = new LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent)
            };

            _androidAppBarLayout = (AppBarLayout)LayoutInflater.FromContext(context).Inflate(Resource.Layout.Toolbar, null);

            toolbar = (Toolbar)_androidAppBarLayout.FindViewById(Resource.Id.toolbar);
            toolbar.FindViewById <TextView>(Resource.Id.cycles_text).Text = "How To Cycle";
            toolbar.FindViewById <Android.Widget.ImageButton>(Resource.Id.gift_button).Visibility = ViewStates.Invisible;

            _androidLinearLayout.AddView(_androidAppBarLayout);

            _androidAppBarLayout.LayoutParameters =
                new LinearLayout.LayoutParams(LayoutParams.MatchParent, LayoutParams.WrapContent);

            AddView(_androidLinearLayout);

            mainActivity.SetSupportActionBar(toolbar);
            ActionBar actionBar = mainActivity.SupportActionBar;

            actionBar.SetDisplayHomeAsUpEnabled(true);
            actionBar.Title = "How To Cycle";
            actionBar.SetDisplayShowHomeEnabled(true);
            actionBar.SetDisplayShowTitleEnabled(false);
        }