コード例 #1
0
ファイル: Activity1.cs プロジェクト: GSerjo/Seminars
  void AddTab (string tabText, int iconResourceId)
  {
      var tab = this.ActionBar.NewTab ();            
      tab.SetText (tabText);
      tab.SetIcon (Resource.Drawable.ic_tab_white);
      
      // must set event handler before adding tab
      tab.TabSelected += delegate(object sender, ActionBar.TabEventArgs e) { 
          if (_sampleFragment != null)
              e.FragmentTransaction.Remove (_sampleFragment);
 
          _sampleFragment = new SampleTabFragment (tabText);
          
          e.FragmentTransaction.Add (Resource.Id.fragmentContainer, _sampleFragment);
      };
      
      this.ActionBar.AddTab (tab);
  }
コード例 #2
0
        void AddTab(string tabText, int iconResourceId)
        {
            var tab = this.ActionBar.NewTab();

            tab.SetText(tabText);
            tab.SetIcon(Resource.Drawable.ic_tab_white);

            // must set event handler before adding tab
            tab.TabSelected += delegate(object sender, ActionBar.TabEventArgs e) {
                if (_sampleFragment != null)
                {
                    e.FragmentTransaction.Remove(_sampleFragment);
                }

                _sampleFragment = new SampleTabFragment(tabText);

                e.FragmentTransaction.Add(Resource.Id.fragmentContainer, _sampleFragment);
            };

            this.ActionBar.AddTab(tab);
        }