protected override void OnCreate(Bundle savedInstanceState) { NavigationItemId = Resource.Id.SideMenu_Nearby; OnCreate(savedInstanceState, Resource.Layout.NearbyActivity); Title = "Autour de moi"; // Tabs viewPager = FindViewById <ViewPager>(Resource.Id.NearbyActivity_ViewPager); viewPager.Adapter = fragmentsAdapter = new TabFragmentsAdapter(SupportFragmentManager, mapFragment, stopsFragment); viewPager.OffscreenPageLimit = 1; TabLayout tabLayout = FindViewById <TabLayout>(Resource.Id.NearbyActivity_Tabs); tabLayout.SetupWithViewPager(viewPager); viewPager.SetCurrentItem(1, false); }
protected override void OnCreate(Bundle savedInstanceState) { NavigationItemId = Resource.Id.SideMenu_Home; OnCreate(savedInstanceState, Resource.Layout.HomeActivity); // Tabs viewPager = FindViewById <ViewPager>(Resource.Id.MainActivity_ViewPager); viewPager.OffscreenPageLimit = 2; viewPager.Adapter = fragmentsAdapter = new TabFragmentsAdapter(SupportFragmentManager, favoritesFragment, linesFragment, stopsFragment); viewPager.PageSelected += ViewPager_PageSelected; TabLayout tabLayout = FindViewById <TabLayout>(Resource.Id.MainActivity_Tabs); tabLayout.SetupWithViewPager(viewPager); if (TramUrWayApplication.Config.ShowFavorites && TramUrWayApplication.Config.FavoriteStops.Any()) { viewPager.SetCurrentItem(0, true); } else { viewPager.SetCurrentItem(1, true); } }