Esempio n. 1
0
        /* Sets up the viewpager, tabs, and the titles of the tabs when the  */
        /* campus life item is selected                                      */
        public override View OnCreateView(LayoutInflater inflater,
                                          ViewGroup container, Bundle savedInstanceState)
        {
            CurrentView = inflater.Inflate(Resource.Layout.TabLayout,
                                           container, false);

            CurrentPager =
                CurrentView.FindViewById <ViewPager>(Resource.Id.MainViewPager);
            CurrentPager.Adapter =
                new navigationAdapter(ChildFragmentManager,
                                      CampusLifeFragments,
                                      App.Tabs.CampusLifePage);

            TabLayout =
                CurrentView.FindViewById <TabLayout>(Resource.Id.MainTabLayout);

            TabLayout.SetupWithViewPager(CurrentPager);

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

            toolbar.InflateMenu(Resource.Menu.toolbar_menu);


            toolbar.MenuItemClick += Toolbar_MenuItemClick;
            return(CurrentView);
        }
Esempio n. 2
0
        public override View OnCreateView(LayoutInflater inflater,
                                          ViewGroup container, Bundle savedInstanceState)
        {
            /* Use this to return your custom view for this Fragment         */
            Activity.RunOnUiThread(() => CurrentView = inflater.Inflate(Resource.Layout.TabLayout,
                                                                        container, false));

            CurrentPager =
                CurrentView.FindViewById <ViewPager>(Resource.Id.MainViewPager);

            Activity.RunOnUiThread(() => CurrentPager.Adapter =
                                       new navigationAdapter(ChildFragmentManager, DiningFragments,
                                                             App.Tabs.DiningPage));

            Activity.RunOnUiThread(() => TabLayout =
                                       CurrentView.FindViewById <TabLayout>(Resource.Id.MainTabLayout));

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

            toolbar.InflateMenu(Resource.Menu.toolbar_menu);

            toolbar.MenuItemClick += Toolbar_MenuItemClick;

            /* Set the tablayout to fixed so that the titles aren't smashed  */
            /* together. REMINDER: BACKLIST: get width of tabLayout and set  */
            /* Fixed or Scrollable depending on the width                    */
            TabLayout.TabMode = TabLayout.ModeFixed;
            Activity.RunOnUiThread(() => TabLayout.SetupWithViewPager(CurrentPager));

            return(CurrentView);
        }