protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            m_Pager = FindViewById<ViewPager>(Resource.Id.pager);
            m_Adapter = new MainPagerAdapter(SupportFragmentManager);
            m_Pager.Adapter = m_Adapter;

#if __ANDROID_11__
            m_Pager.SetOnPageChangeListener(this);
            ActionBar.NavigationMode = ActionBarNavigationMode.Tabs;
            var tab = ActionBar.NewTab();
            tab.SetText("1");
            tab.SetTabListener(this);

            ActionBar.AddTab(tab);

            tab = ActionBar.NewTab();
            tab.SetText("2");
            tab.SetTabListener(this);
            ActionBar.AddTab(tab);
            
            tab = ActionBar.NewTab();
            tab.SetText("3");
            tab.SetTabListener(this);
            ActionBar.AddTab(tab); 
            
            tab = ActionBar.NewTab();
            tab.SetText("4");
            tab.SetTabListener(this);
            ActionBar.AddTab(tab);
#endif

        }
Esempio n. 2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            m_Pager         = FindViewById <ViewPager>(Resource.Id.pager);
            m_Adapter       = new MainPagerAdapter(SupportFragmentManager);
            m_Pager.Adapter = m_Adapter;

#if __ANDROID_11__
            m_Pager.SetOnPageChangeListener(this);
            ActionBar.NavigationMode = ActionBarNavigationMode.Tabs;
            var tab = ActionBar.NewTab();
            tab.SetText("1");
            tab.SetTabListener(this);

            ActionBar.AddTab(tab);

            tab = ActionBar.NewTab();
            tab.SetText("2");
            tab.SetTabListener(this);
            ActionBar.AddTab(tab);

            tab = ActionBar.NewTab();
            tab.SetText("3");
            tab.SetTabListener(this);
            ActionBar.AddTab(tab);

            tab = ActionBar.NewTab();
            tab.SetText("4");
            tab.SetTabListener(this);
            ActionBar.AddTab(tab);
#endif
        }