public override void OnViewCreated(View view, Bundle savedInstanceState) { mSlidingTabScrollView = view.FindViewById <SlidingTabScrollView>(Resource.Id.sliding_tabs); mViewPager = view.FindViewById <ViewPager>(Resource.Id.viewpager); mViewPager.Adapter = new SamplePagerAdapter(); mSlidingTabScrollView.ViewPager = mViewPager; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); main_layout = FindViewById <RelativeLayout>(Resource.Id.main_layout); var mToolbar = FindViewById <SupportToolbar>(Resource.Id.toolbar); mDrawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); mLeftDrawer = FindViewById <NavigationView>(Resource.Id.left_drawer); mLeftDrawer.NavigationItemSelected += (sender, e) => { e.MenuItem.SetChecked(true); Intent intent; //new intent switch (e.MenuItem.ItemId) { case Resource.Id.menu_addGoal: intent = new Intent(this, typeof(AddGoalActivity)); StartActivity(intent); break; case Resource.Id.menu_addGoalTask: intent = new Intent(this, typeof(AddGoalTaskActivity)); StartActivity(intent); break; case Resource.Id.menu_addProject: intent = new Intent(this, typeof(AddProjectActivity)); StartActivity(intent); break; case Resource.Id.menu_addProjectTask: intent = new Intent(this, typeof(AddProjectTaskActivity)); StartActivity(intent); break; case Resource.Id.menu_addBudget: Toast.MakeText(this, "Go: " + e.MenuItem.TitleFormatted, ToastLength.Short).Show(); break; case Resource.Id.menu_addBudgetItem: Toast.MakeText(this, "Go: " + e.MenuItem.TitleFormatted, ToastLength.Short).Show(); break; case Resource.Id.menu_addShopList: intent = new Intent(this, typeof(AddShoppingListActivity)); StartActivity(intent); break; case Resource.Id.menu_addShopItem: intent = new Intent(this, typeof(AddShoppingItemActivity)); StartActivity(intent); break; } mDrawerLayout.CloseDrawers(); }; SetSupportActionBar(mToolbar); mDrawerToggle = new MyActionBarDrawerToggle( this, //host activity mDrawerLayout, //drawer layout Resource.String.openedDrawer, //Opened message Resource.String.closedDrawer //Close message ); mDrawerLayout.SetDrawerListener(mDrawerToggle); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); SupportActionBar.SetDisplayShowTitleEnabled(true); mDrawerToggle.SyncState(); //if (bundle != null) //{ //} //else //{ // SupportActionBar.SetTitle(Resource.String.closedDrawer); //} //FragmentTransaction transaction = FragmentManager.BeginTransaction(); //SlidingTabsFragment fragment = new SlidingTabsFragment(); //transaction.Replace(Resource.Id.main_content_fragment, fragment); //transaction.Commit(); mScrollView = FindViewById <SlidingTabScrollView>(Resource.Id.sliding_tabs); mViewPager = FindViewById <ViewPager>(Resource.Id.viewpager); mViewPager.Adapter = new MainPageAdapter(SupportFragmentManager); mScrollView.ViewPager = mViewPager; }