Beispiel #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            StatusBarCompat.SetOrdinaryToolBar(this);

            toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);
            toolbar.SetNavigationIcon(Resource.Drawable.back_24dp);
            SetSupportActionBar(toolbar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            toolbar.SetNavigationOnClickListener(this);
            searchView = FindViewById <SearchView>(Resource.Id.searchView);
            searchView.SetIconifiedByDefault(true);
            searchView.OnActionViewExpanded();
            searchView.SetOnQueryTextListener(this);

            viewPager = FindViewById <ViewPager>(Resource.Id.viewPager);
            viewPager.OffscreenPageLimit = 4;

            TabLayout tabs = FindViewById <TabLayout>(Resource.Id.tabLayout);

            adapter = new SearchTabsAdapter(this.SupportFragmentManager, Resources.GetStringArray(Resource.Array.SearchTabs).ToList());

            viewPager.Adapter = adapter;
            tabs.SetupWithViewPager(viewPager);
            tabs.AddOnTabSelectedListener(this);
        }
Beispiel #2
0
        public override void OnViewCreated(View view, Bundle savedInstanceState)
        {
            base.OnViewCreated(view, savedInstanceState);

            viewPager = view.FindViewById <ViewPager>(Resource.Id.viewPager);
            viewPager.OffscreenPageLimit = 4;

            TabLayout tabs = view.FindViewById <TabLayout>(Resource.Id.tabs);

            adapter = new SearchTabsAdapter(this.ChildFragmentManager, this.Activity.Resources.GetStringArray(Resource.Array.SearchTabs).ToList());

            viewPager.Adapter = adapter;
            tabs.TabMode      = TabLayout.GravityCenter;
            tabs.SetupWithViewPager(viewPager);
            tabs.AddOnTabSelectedListener(this);
        }