void AddTabToActionBar(string label) { ActionBar.Tab tab = SupportActionBar.NewTab() .SetText(label) .SetTabListener(this); SupportActionBar.AddTab(tab); }
protected override void OnCreate(Bundle bundle) { SetTheme(Resource.Style.Theme_Sherlock_Light); base.OnCreate(bundle); SetContentView(Resource.Layout.MainNavigation); SupportActionBar.NavigationMode = SherlockActionBar.NavigationModeTabs; SupportActionBar.SetDisplayShowTitleEnabled(false); SupportActionBar.SetDisplayShowHomeEnabled(false); Pager = FindViewById <ViewPager> (Resource.Id.pager); var fm = SupportFragmentManager; Pager.PageSelected += (object sender, ViewPager.PageSelectedEventArgs e) => { SupportActionBar.SetSelectedNavigationItem(e.Position); }; Pager.Adapter = new ViewPagerAdapter(fm); var tab = SupportActionBar.NewTab().SetText("Mapa").SetTabListener(this); SupportActionBar.AddTab(tab); tab = SupportActionBar.NewTab().SetText("FAQS").SetTabListener(this); SupportActionBar.AddTab(tab); tab = SupportActionBar.NewTab().SetText("Acerca de").SetTabListener(this); SupportActionBar.AddTab(tab); }
void AddTabToActionBar(int labelResourceId, int iconResourceId) { ActionBar.Tab tab = SupportActionBar.NewTab() .SetText(labelResourceId) .SetIcon(iconResourceId) .SetTabListener(this); SupportActionBar.AddTab(tab); }
void AddTabToActionBar(int labelResourceId, int iconResourceId) { Android.Support.V7.App.ActionBar.Tab tab = SupportActionBar.NewTab() .SetText(labelResourceId) .SetIcon(iconResourceId) .SetTabListener(this); //tab.TabSelected += TabOnTabSelected; SupportActionBar.AddTab(tab); }
// private WebView webView; #region Android Event Handlers protected override void OnCreate(Bundle bundle) { // Set color schema for activity Main.SetTheme(this); int[] tabs = { Resource.String.detail_tab_overview, Resource.String.detail_tab_description, Resource.String.detail_tab_history, Resource.String.detail_tab_logs }; base.OnCreate(bundle); SupportActionBar.NavigationMode = global::Android.Support.V7.App.ActionBar.NavigationModeTabs; SupportActionBar.SetDisplayHomeAsUpEnabled(true); // Get cartridge Intent intent = this.Intent; _cart = MainApp.Cartridges [intent.GetIntExtra("cartridge", 0)]; if (_cart == null) { Finish(); } string filename = System.IO.Path.Combine(global::Android.OS.Environment.ExternalStorageDirectory.AbsolutePath, "WF.Player", "poster.png"); InitDetailInfo(); // using (FileStream stream = new FileStream(filename, FileMode.Create)) // { // Bitmap bm = BitmapFactory.DecodeByteArray (cart.Poster.Data,0,cart.Poster.Data.Length); // bm.Compress (Bitmap.CompressFormat.Png, 100, stream); // } // } // else { // if (File.Exists (filename)) // File.Delete(filename); for (int i = 0; i < 4; i++) { var tab = SupportActionBar.NewTab(); tab.SetText(GetString(tabs[i])); tab.SetTabListener(this); SupportActionBar.AddTab(tab); } SupportActionBar.Title = _cart.Name; }
protected override void OnCreate(Bundle savedInstanceState) { Window.SetFlags(WindowManagerFlags.Fullscreen, WindowManagerFlags.Fullscreen); base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Extra_BeSmart_MainView); SupportActionBar.SetDisplayShowCustomEnabled(true); SupportActionBar.SetCustomView(Resource.Layout.Extra_BeSmart_ActionBar); SupportActionBar.NavigationMode = Convert.ToInt32(ActionBarNavigationMode.Tabs); SupportActionBar.SetHomeButtonEnabled(false); SupportActionBar.SetDisplayShowHomeEnabled(false); SupportActionBar.SetBackgroundDrawable(new ColorDrawable(Android.Graphics.Color.Rgb(213, 219, 254))); SupportActionBar.SetStackedBackgroundDrawable(new ColorDrawable(Android.Graphics.Color.Rgb(213, 219, 254))); var tab1 = SupportActionBar.NewTab(); tab1.SetText("Cauta produs"); tab1.SetTabListener(this); var tab2 = SupportActionBar.NewTab(); tab2.SetText("Cauta magazin"); tab2.SetTabListener(this); SupportActionBar.AddTab(tab1); SupportActionBar.AddTab(tab2); { ImageView ActionBarIcon = SupportActionBar.CustomView.FindViewById <ImageView>(Resource.Id.imageView1); TextView ActionBarPromo = SupportActionBar.CustomView.FindViewById <TextView>(Resource.Id.textView1); SetBeatingAnimation(ActionBarIcon); SetTypeface.Normal.SetTypeFace(this, ActionBarPromo); } FragmentContainer = FindViewById <FrameLayout>(Resource.Id.frameLayout1); FragmentTransaction transact = FragmentManager.BeginTransaction(); CautaMagazinFragment = new BeSmart_Main_CautaMagazinFragment(); CautaProdusFragment = new BeSmart_Main_CautaProdusFragment(); transact.Add(FragmentContainer.Id, CautaMagazinFragment, "CautaMagazin"); transact.Hide(CautaMagazinFragment); transact.Add(FragmentContainer.Id, CautaProdusFragment, "CautaProdus"); transact.Commit(); }
/// <summary> /// Adds the tab. /// </summary> /// <param name="tag">The tag.</param> /// <param name="text">The text.</param> /// <param name="icon">The icon.</param> private void AddTab(TabType tag, string text, int?icon = null) { var tab = SupportActionBar.NewTab(); tab.SetText(text); if (icon.HasValue) { tab.SetIcon(icon.GetValueOrDefault()); } tab.SetTabListener(this); tab.SetTag(Convert.ToString(tag)); SupportActionBar.AddTab(tab, false); _tabIndicies = _tabIndicies ?? new Dictionary <TabType, int>(); _tabIndicies.Add(tag, _tabIndicies.Count); }
protected override void OnCreate(Bundle savedInstanceState) { SetTheme(SampleList.THEME); //Used for theme switching in samples base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.tab_navigation); mSelected = FindViewById <TextView> (Resource.Id.text); SupportActionBar.NavigationMode = SherlockActionBar.NavigationModeTabs; for (int i = 1; i <= 3; i++) { var tab = SupportActionBar.NewTab(); tab.SetText("Tab " + i); tab.SetTabListener(this); SupportActionBar.AddTab(tab); } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Customized); var setting = Android.Support.V7.App.ActionBar.NavigationModeTabs; SupportActionBar.NavigationMode = setting; var tab = SupportActionBar.NewTab(); tab.SetText("Tab 1"); tab.SetTabListener(this); SupportActionBar.AddTab(tab); var tab2 = SupportActionBar.NewTab(); tab2.SetText("Tab 2"); tab2.SetTabListener(this); SupportActionBar.AddTab(tab2); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); var pagerAdapter = new SectionsPagerAdapter(this.SupportFragmentManager); SetContentView(Resource.Layout.activity_score); var toolbar = FindViewById <Toolbar> (Resource.Id.toolbar); SupportActionBar.SetDisplayUseLogoEnabled(false); SupportActionBar.SetLogo(new ColorDrawable(Resources.GetColor(Resource.Color.transparent))); SupportActionBar.SetHomeButtonEnabled(false); SupportActionBar.SetDisplayShowTitleEnabled(false); SupportActionBar.SetDisplayShowHomeEnabled(false); SupportActionBar.SetBackgroundDrawable(new Android.Graphics.Drawables.ColorDrawable(Color.Transparent)); // SupportActionBar.NavigationMode = (int) ActionBarNavigationMode.Tabs; SupportActionBar.SetStackedBackgroundDrawable(new Android.Graphics.Drawables.ColorDrawable(Color.Transparent)); sectionsViewPager = FindViewById <ViewPager> (Resource.Id.sections_pager); sectionsViewPager.Adapter = pagerAdapter; sectionsViewPager.OffscreenPageLimit = (int)TrimMemory.RunningModerate; sectionsViewPager.PageSelected += (object sender, ViewPager.PageSelectedEventArgs e) => { // SupportActionBar.SetSelectedNavigationItem(e.Position); }; // Add a tab to the action bar for each subsection for (int i = 0; i < pagerAdapter.Count; i++) { Android.Support.V7.App.ActionBar.Tab scheduleTab = SupportActionBar.NewTab().SetIcon(pagerAdapter.PageIcon(i)); scheduleTab.SetTabListener(this); SupportActionBar.AddTab(scheduleTab); } }
protected override void OnCreate(Bundle savedInstanceState) { SetTheme(SampleList.THEME); //Used for theme switching in samples RequestWindowFeature(WindowFeatures.Progress); RequestWindowFeature(WindowFeatures.IndeterminateProgress); base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.feature_toggles); SetSupportProgressBarIndeterminateVisibility(false); SetSupportProgressBarVisibility(false); SupportActionBar.SetCustomView(Resource.Layout.custom_view); SupportActionBar.SetDisplayShowCustomEnabled(false); Context context = SupportActionBar.ThemedContext; var listAdapter = ArrayAdapter.CreateFromResource(context, Resource.Array.locations, Resource.Layout.sherlock_spinner_item); listAdapter.SetDropDownViewResource(Resource.Layout.sherlock_spinner_dropdown_item); SupportActionBar.SetListNavigationCallbacks(listAdapter, null); FindViewById(Resource.Id.display_progress_show).Click += delegate { SetSupportProgressBarVisibility(true); SetSupportProgressBarIndeterminateVisibility(false); SetSupportProgress(RANDOM.Next(8000) + 10); }; FindViewById(Resource.Id.display_progress_hide).Click += delegate { SetSupportProgressBarVisibility(false); }; FindViewById(Resource.Id.display_iprogress_show).Click += delegate { //Hack to hide the regular progress bar SetSupportProgress((int)Xamarin.ActionbarSherlockBinding.Views.Window.ProgressEnd); SetSupportProgressBarIndeterminateVisibility(true); }; FindViewById(Resource.Id.display_iprogress_hide).Click += delegate { SetSupportProgressBarIndeterminateVisibility(false); }; FindViewById(Resource.Id.display_items_clear).Click += delegate { items = 0; InvalidateOptionsMenu(); }; FindViewById(Resource.Id.display_items_add).Click += delegate { items += 1; InvalidateOptionsMenu(); }; FindViewById(Resource.Id.display_subtitle_show).Click += delegate { SupportActionBar.Subtitle = "The quick brown fox jumps over the lazy dog."; }; FindViewById(Resource.Id.display_subtitle_hide).Click += delegate { SupportActionBar.Subtitle = null; }; FindViewById(Resource.Id.display_title_show).Click += delegate { SupportActionBar.SetDisplayShowTitleEnabled(true); }; FindViewById(Resource.Id.display_title_hide).Click += delegate { SupportActionBar.SetDisplayShowTitleEnabled(false); }; FindViewById(Resource.Id.display_custom_show).Click += delegate { SupportActionBar.SetDisplayShowCustomEnabled(true); }; FindViewById(Resource.Id.display_custom_hide).Click += delegate { SupportActionBar.SetDisplayShowCustomEnabled(false); }; FindViewById(Resource.Id.navigation_standard).Click += delegate { SupportActionBar.NavigationMode = SherlockActionBar.NavigationModeStandard; }; FindViewById(Resource.Id.navigation_list).Click += delegate { SupportActionBar.NavigationMode = SherlockActionBar.NavigationModeList; }; FindViewById(Resource.Id.navigation_tabs).Click += delegate { SupportActionBar.NavigationMode = SherlockActionBar.NavigationModeTabs; }; FindViewById(Resource.Id.display_home_as_up_show).Click += delegate { SupportActionBar.SetDisplayHomeAsUpEnabled(true); }; FindViewById(Resource.Id.display_home_as_up_hide).Click += delegate { SupportActionBar.SetDisplayHomeAsUpEnabled(false); }; FindViewById(Resource.Id.display_logo_show).Click += delegate { SupportActionBar.SetDisplayUseLogoEnabled(true); }; FindViewById(Resource.Id.display_logo_hide).Click += delegate { SupportActionBar.SetDisplayUseLogoEnabled(false); }; FindViewById(Resource.Id.display_home_show).Click += delegate { SupportActionBar.SetDisplayShowHomeEnabled(true); }; FindViewById(Resource.Id.display_home_hide).Click += delegate { SupportActionBar.SetDisplayShowHomeEnabled(false); }; FindViewById(Resource.Id.display_actionbar_show).Click += delegate { SupportActionBar.Show(); }; FindViewById(Resource.Id.display_actionbar_hide).Click += delegate { SupportActionBar.Hide(); }; Button tabAdd = FindViewById <Button> (Resource.Id.display_tab_add); tabAdd.Click += delegate { SherlockActionBar.Tab newTab = SupportActionBar.NewTab(); if (RANDOM.Next() % 2 == 1) { newTab.SetCustomView(Resource.Layout.tab_custom_view); } else { bool icon = RANDOM.Next() % 2 == 1; if (icon) { newTab.SetIcon(Resource.Drawable.ic_title_share_default); } if (!icon || RANDOM.Next() % 2 == 1) { newTab.SetText("Text!"); } } newTab.SetTabListener(this); SupportActionBar.AddTab(newTab); }; //Add some tabs tabAdd.PerformClick(); tabAdd.PerformClick(); tabAdd.PerformClick(); FindViewById(Resource.Id.display_tab_select).Click += delegate { if (SupportActionBar.TabCount > 0) { SupportActionBar.SelectTab( SupportActionBar.GetTabAt( RANDOM.Next(SupportActionBar.TabCount) ) ); } }; FindViewById(Resource.Id.display_tab_remove).Click += delegate { if (SupportActionBar.TabCount > 0) { SupportActionBar.RemoveTabAt(SupportActionBar.TabCount - 1); } }; FindViewById(Resource.Id.display_tab_remove_all).Click += delegate { SupportActionBar.RemoveAllTabs(); }; }