Exemple #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(R.Layouts.fragment_tabs_pager);
            mTabHost = (TabHost)FindViewById(global::Android.R.Id.Tabhost);
            mTabHost.Setup();

            mViewPager = (ViewPager)FindViewById(R.Ids.pager);

            mTabsAdapter = new TabsAdapter(this, mTabHost, mViewPager);

            mTabsAdapter.AddTab(mTabHost.NewTabSpec("simple").SetIndicator("Simple"),
                                typeof(FragmentStackSupport.CountingFragment), null);
            mTabsAdapter.AddTab(mTabHost.NewTabSpec("contacts").SetIndicator("Contacts"),
                                typeof(LoaderCursorSupport.CursorLoaderListFragment), null);
            mTabsAdapter.AddTab(mTabHost.NewTabSpec("custom").SetIndicator("Custom"),
                                typeof(LoaderCustomSupport.AppListFragment), null);
            mTabsAdapter.AddTab(mTabHost.NewTabSpec("throttle").SetIndicator("Throttle"),
                                typeof(LoaderThrottleSupport.ThrottledLoaderListFragment), null);

            if (savedInstanceState != null)
            {
                mTabHost.SetCurrentTabByTag(savedInstanceState.GetString("tab"));
            }
        }
Exemple #2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            MenuId = Resource.Menu.mainmenu;

            SetContentView(Resource.Layout.fragment_tabs);
            _tabHost = FindViewById <TabHost>(Android.Resource.Id.TabHost);
            _tabHost.Setup();

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

            _tabsAdapter = new TabsAdapter(this, _tabHost, _viewPager);


            LegacyBar       = FindViewById <Library.Bar.LegacyBar>(Resource.Id.actionbar);
            LegacyBar.Title = "Look Fragments";
            AddHomeAction(typeof(HomeActivity), Resource.Drawable.icon);


            var action = new MenuItemLegacyBarAction(this, Resource.Id.menu_search,
                                                     Resource.Drawable.ic_action_search_dark,
                                                     Resource.String.menu_string_search);

            LegacyBar.AddAction(action);


            TabHost.TabSpec spec = _tabHost.NewTabSpec("tv");
            spec.SetIndicator("Tab 1", Resources.GetDrawable(Resource.Drawable.icon));
            _tabsAdapter.AddTab(spec, Class.FromType(typeof(FramgmentTab1)), null);


            spec = _tabHost.NewTabSpec("tab2");
            spec.SetIndicator("Tab 2", Resources.GetDrawable(Resource.Drawable.icon));
            _tabsAdapter.AddTab(spec, Class.FromType(typeof(FramgmentTab2)), null);

            if (bundle != null)
            {
                _tabHost.SetCurrentTabByTag(bundle.GetString("tab"));
            }
            else
            {
                _tabHost.CurrentTab = 0;
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate (savedInstanceState);

            SetContentView(Resource.Layout.fragment_tabs_pager);
            tabHost = FindViewById<TabHost>(Android.Resource.Id.TabHost);
            tabHost.Setup();

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

            tabsAdapter = new TabsAdapter(this, tabHost, viewPager);

            tabsAdapter.AddTab(tabHost.NewTabSpec("simple").SetIndicator("Simple"), Java.Lang.Class.FromType(typeof(FragmentStackSupport.CountingFragment)), null);
            tabsAdapter.AddTab(tabHost.NewTabSpec("contacts").SetIndicator("Custom"), Java.Lang.Class.FromType(typeof(LoaderCursorSupport.CursorLoaderListFragment)), null);

            if (savedInstanceState != null) {
                tabHost.SetCurrentTabByTag(savedInstanceState.GetString("tab"));
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.fragment_tabs_pager);
            tabHost = FindViewById <TabHost>(Android.Resource.Id.TabHost);
            tabHost.Setup();

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

            tabsAdapter = new TabsAdapter(this, tabHost, viewPager);


            tabsAdapter.AddTab(tabHost.NewTabSpec("simple").SetIndicator("Simple"), Java.Lang.Class.FromType(typeof(FragmentStackSupport.CountingFragment)), null);
            tabsAdapter.AddTab(tabHost.NewTabSpec("contacts").SetIndicator("Custom"), Java.Lang.Class.FromType(typeof(LoaderCursorSupport.CursorLoaderListFragment)), null);

            if (savedInstanceState != null)
            {
                tabHost.SetCurrentTabByTag(savedInstanceState.GetString("tab"));
            }
        }
Exemple #5
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.fragment_tabs_pager);
            tabHost = FindViewById <TabHost>(Android.Resource.Id.TabHost);
            tabHost.Setup();

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

            tabsAdapter = new TabsAdapter(this, tabHost, viewPager);

            tabsAdapter.AddTab(tabHost.NewTabSpec("Goal").SetIndicator(string.Empty, Resources.GetDrawable(Resource.Drawable.target)), Java.Lang.Class.FromType(typeof(GoalFragment)), null);
            tabsAdapter.AddTab(tabHost.NewTabSpec("Activities").SetIndicator(string.Empty, Resources.GetDrawable(Resource.Drawable.activities)), Java.Lang.Class.FromType(typeof(ActivitiesFragment)), null);
            tabsAdapter.AddTab(tabHost.NewTabSpec("Contacts").SetIndicator(string.Empty, Resources.GetDrawable(Resource.Drawable.contacts)), Java.Lang.Class.FromType(typeof(ContactsFragment)), null);
            tabsAdapter.AddTab(tabHost.NewTabSpec("Report").SetIndicator(string.Empty, Resources.GetDrawable(Resource.Drawable.report)), Java.Lang.Class.FromType(typeof(ReportsFragment)), null);

            if (savedInstanceState != null)
            {
                tabHost.SetCurrentTabByTag(savedInstanceState.GetString(tabKeyString));
            }
        }
        protected override void OnCreate(Bundle savedInstanceState) {
            base.OnCreate(savedInstanceState);

            SetContentView(R.Layouts.fragment_tabs_pager);
            mTabHost = (TabHost)FindViewById(global::Android.R.Id.Tabhost);
            mTabHost.Setup();

            mViewPager = (ViewPager)FindViewById(R.Ids.pager);

            mTabsAdapter = new TabsAdapter(this, mTabHost, mViewPager);

            mTabsAdapter.AddTab(mTabHost.NewTabSpec("simple").SetIndicator("Simple"),
                    typeof(FragmentStackSupport.CountingFragment), null);
            mTabsAdapter.AddTab(mTabHost.NewTabSpec("contacts").SetIndicator("Contacts"),
                    typeof(LoaderCursorSupport.CursorLoaderListFragment), null);
            mTabsAdapter.AddTab(mTabHost.NewTabSpec("custom").SetIndicator("Custom"),
                    typeof(LoaderCustomSupport.AppListFragment), null);
            mTabsAdapter.AddTab(mTabHost.NewTabSpec("throttle").SetIndicator("Throttle"),
                    typeof(LoaderThrottleSupport.ThrottledLoaderListFragment), null);

            if (savedInstanceState != null) {
                mTabHost.SetCurrentTabByTag(savedInstanceState.GetString("tab"));
            }
        }
Exemple #7
0
 private void InitTabsAdapter()
 {
     mTabsAdapter = new TabsAdapter(this, mViewPager, FragmentManager);
     mTabsAdapter.AddTab(typeof(InterfaceFragment), null);
     mTabsAdapter.NotifyDataSetChanged();
 }