protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); ActionBar.NavigationMode = ActionBarNavigationMode.Tabs; SetContentView(Resource.Layout.AddView); ActionBar.Tab tab = ActionBar.NewTab(); tab.SetText("Wydatek"); tab.TabSelected += (object sender, ActionBar.TabEventArgs e) => { e.FragmentTransaction.Replace(Resource.Id.addHost, new AddExpenseFragment()); }; ActionBar.AddTab(tab); tab = ActionBar.NewTab(); tab.SetText("Przychód"); tab.TabSelected += (object sender, ActionBar.TabEventArgs e) => { e.FragmentTransaction.Replace(Resource.Id.addHost, new AddIncomeFragment()); }; ActionBar.AddTab(tab); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); ActionBar.NavigationMode = ActionBarNavigationMode.Tabs; ActionBar.SetDisplayShowTitleEnabled(false); ActionBar.Tab tab = ActionBar.NewTab(); tab.SetText("Stolen Bike Brands"); tab.SetIcon(Resource.Drawable.Icon); tab.TabSelected += (sender, args) => { listofpieChart data = new listofpieChart(); List <string> test = data.listofpieChart1(); ListAdapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleDropDownItem1Line, test); }; ActionBar.AddTab(tab); tab = ActionBar.NewTab(); tab.SetText("Favorite Stolen Bike Colors"); tab.SetIcon(Resource.Drawable.Icon); tab.TabSelected += (sender, args) => { listofpieChartColor data2 = new listofpieChartColor(); List <string> test2 = data2.listofpieChart1(); ListAdapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleDropDownItem1Line, test2); }; ActionBar.AddTab(tab); }
//private IList<RideModel> rides; protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); IEnumerable <Account> accounts = AccountStore.Create(this).FindAccountsForService("google"); Account useraccount = accounts.FirstOrDefault(); ActionBar.NavigationMode = ActionBarNavigationMode.Tabs; SetContentView(Resource.Layout.Rides); ActionBar.Tab tab = ActionBar.NewTab(); tab.SetText("Rides"); tab.SetIcon(Resource.Drawable.bunchy); tab.TabSelected += (sender, args) => { // Do something when tab is selected }; ActionBar.AddTab(tab); tab = ActionBar.NewTab(); tab.SetText("Following"); tab.SetIcon(Resource.Drawable.bunchy); tab.TabSelected += (sender, args) => { // Do something when tab is selected }; ActionBar.AddTab(tab); var ridesAdapter = new RidesAdapter(this, useraccount.Username); var ridesListView = FindViewById <ListView> (Resource.Id.rideListView); ridesListView.Adapter = ridesAdapter; ridesListView.ItemClick += OnRideItemClick; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); activity = this; /*Creation of tabs.*/ ActionBar.NavigationMode = ActionBarNavigationMode.Tabs; ActionBar.Tab tab = ActionBar.NewTab(); //Tab for list of parameters. tab.SetText(Resource.String.tab_List); tab.TabSelected += Tab_TabSelectedList; ActionBar.AddTab(tab); //Tab for weight plot. tab = ActionBar.NewTab(); tab.SetText(Resource.String.tab_GraphWeight); tab.TabSelected += Tab_TabSelectedWeight; ActionBar.AddTab(tab); //Tab for height plot. tab = ActionBar.NewTab(); tab.SetText(Resource.String.tab_GraphHeight); tab.TabSelected += Tab_TabSelectedHeight; ActionBar.AddTab(tab); //Going to selected tab. SetContentView(Resource.Layout.helpform_ParametersConnector); }
private void SetUpApp() { //below creates the tabs for the homepage and sets them up to do something when they switch ActionBar.NavigationMode = ActionBarNavigationMode.Tabs; ActionBar.Tab tab = ActionBar.NewTab(); tab.SetText("Happy"); tab.TabSelected += (sender, args) => { // Do something when tab is selected selectedTab = 0; SwitchTabs(selectedTab); }; ActionBar.AddTab(tab); tab = ActionBar.NewTab(); tab.SetText("Inspiration"); tab.TabSelected += (sender, args) => { // Do something when tab is selected selectedTab = 1; SwitchTabs(selectedTab); }; ActionBar.AddTab(tab); tab = ActionBar.NewTab(); tab.SetText("Motivation"); tab.TabSelected += (sender, args) => { // Do something when tab is selected selectedTab = 2; SwitchTabs(selectedTab); }; ActionBar.AddTab(tab); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.tablayout); ActionBar.NavigationMode = ActionBarNavigationMode.Tabs; ActionBar.SetDisplayShowTitleEnabled(false); ActionBar.Tab tab = ActionBar.NewTab(); tab.SetText("Group Bar Chart"); tab.SetIcon(Resource.Drawable.barfix); tab.TabSelected += (sender, args) => { SetContentView(Resource.Layout.barChartEdit); List <string> spinnerArray = new List <string>(); List <string> Buurten = preLoad.csvFD.getBuurten(); Dictionary <int, string> Districts = new Dictionary <int, string>(); Districts.Add(3, "Delfshaven"); Districts.Add(4, "Centrum"); Districts.Add(5, "Noord-Hillegersberg"); Districts.Add(6, "Kralingen/Crooswijk"); Districts.Add(9, "Feijenoord"); Districts.Add(10, "Charlois"); foreach (string item in Buurten) { if (item.Length > 0) { spinnerArray.Add(item.Remove(0, 2)); } } Spinner spinner = FindViewById <Spinner>(Resource.Id.spinner); spinner.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(spinner_ItemSelected); var adapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerItem, spinnerArray); adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); spinner.Adapter = adapter; }; ActionBar.AddTab(tab); tab = ActionBar.NewTab(); tab.SetText("Single Bar Chart"); tab.SetIcon(Resource.Drawable.barfix); tab.TabSelected += (sender, args) => { SetContentView(Resource.Layout.barChart); PlotView view = FindViewById <PlotView>(Resource.Id.plot_view_bar); CreateBarChart barchart = new CreateBarChart(); view.Model = barchart.CreatePlotModel(); }; ActionBar.AddTab(tab); }
//protected override void OnElementChanged(VisualElement oldModel, VisualElement newModel) //protected override void OnElementChanged(ElementChangedEventArgs<TabbedPage> e) protected override void OnDraw(Canvas canvas) { _activity = this.Context as Activity; ActionBar actionBar = _activity.ActionBar; if (actionBar.TabCount > 0) { ActionBar.Tab tabPrompting = actionBar.GetTabAt(0); ActionBar.Tab tabActivities = actionBar.GetTabAt(1); ActionBar.Tab tabReminders = actionBar.GetTabAt(2); ActionBar.Tab tabMapping = actionBar.GetTabAt(3); ActionBar.Tab tabSettings = actionBar.GetTabAt(4); //Set the tab icons tabPrompting.SetIcon(Resource.Drawable.ic_description_white_24dp); tabActivities.SetIcon(Resource.Drawable.ic_local_activity_white_24dp); tabReminders.SetIcon(Resource.Drawable.ic_schedule_white_24dp); tabMapping.SetIcon(Resource.Drawable.ic_map_white_24dp); tabSettings.SetIcon(Resource.Drawable.ic_settings_white_24dp); //Remove the page's title from the tab tabPrompting.SetText(""); tabActivities.SetText(""); tabReminders.SetText(""); tabMapping.SetText(""); tabSettings.SetText(""); base.OnDraw(canvas); } }
private void AddTab(string tabTexto) { ActionBar.Tab tab = ActionBar.NewTab(); tab.SetText(tabTexto); tab.TabSelected += OnTabSelected; ActionBar.AddTab(tab); }
void AddTabToActionBar(string tabTitle) { ActionBar.Tab tab = ActionBar.NewTab(); tab.SetText(tabTitle); tab.TabSelected += TabOnTabSelected; //tab.SetIcon(Android.Resource.Drawable.IcInputAdd); ActionBar.AddTab(tab); }
void AddTabToActionBar(string tabTitle, int ImageId) { ActionBar.Tab tab = ActionBar.NewTab().SetText(tabTitle); //tab.SetIcon(ImageId); tab.SetText(tabTitle); tab.TabSelected += TabOnTabSelected; ActionBar.AddTab(tab); }
public static void EditTabText(int tabId, string text) { ActionBar.Tab tab = m_actionBars[tabId]; tab.SetText(text); /*for (int j = 0; j < TabWidget.get; j++) { * TextView tv = (TextView)TabWidget.GetChildAt(j).FindViewById(Android.Resource.Id.Title); * tv.SetTextColor(Android.Graphics.Color.ParseColor("#F9F5AD")); * tv.SetTextSize(Android.Util.ComplexUnitType.Sp, 12); * }*/ }
public static void TranslateTabs() { Localization.CheckCode(); for (int i = 0; i < m_actionBars.Count; i++) { ActionBar.Tab tab = m_actionBars[i]; ScriptingFragment fragment = ScriptingFragment.GetFragment(i); string translated = Localization.GetText(fragment.GetText()); tab.SetText(translated); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); ActionBar.NavigationMode = ActionBarNavigationMode.Tabs; ActionBar.Tab mytab = ActionBar.NewTab(); mytab.SetText(Resource.String.tab1_text); mytab.SetIcon(Resource.Drawable.images); mytab.TabSelected += Mytab_TabSelected; ActionBar.AddTab(mytab); mytab = ActionBar.NewTab(); mytab.SetText(Resource.String.tab2_text); mytab.SetIcon(Resource.Drawable.download); mytab.TabReselected += Mytab_TabReselected; ActionBar.AddTab(mytab); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); this.SetContentView(Resource.Layout.ThreeView); ActionBar.NavigationMode = ActionBarNavigationMode.Tabs; ActionBar.Tab tab = ActionBar.NewTab(); tab.SetText(Resources.GetString(Resource.String.Home)); tab.SetIcon(Resource.Drawable.Icon); tab.SetTabListener(new TabListener <HomeFragment>(this, "Home")); ActionBar.AddTab(tab); tab = ActionBar.NewTab(); tab.SetText(Resources.GetString(Resource.String.Games)); tab.SetIcon(Resource.Drawable.Icon); tab.SetTabListener(new TabListener <GamesFragment>(this, "Games")); ActionBar.AddTab(tab); }
void InitView() { ident = new Identification();; acqu = new Acquisition(); grab = new Grab(); verify = new Verify(); actionbar = ActionBar; // 设置标签导航模式 actionbar.NavigationMode = ActionBarNavigationMode.Tabs; ActionBar.Tab tab1 = ActionBar.NewTab(); tab1.SetText("Identification"); tab1.TabSelected += (sender, e) => { // Do something when tab is selected e.FragmentTransaction.Replace(Android.Resource.Id.Content, ident); }; ActionBar.Tab tab2 = ActionBar.NewTab(); tab2.SetText("Verify"); tab2.TabSelected += (sender, e) => { // Do something when tab is selected e.FragmentTransaction.Replace(Android.Resource.Id.Content, verify); }; ActionBar.Tab tab3 = ActionBar.NewTab(); tab3.SetText("Acquisition"); tab3.TabSelected += (sender, e) => { // Do something when tab is selected e.FragmentTransaction.Replace(Android.Resource.Id.Content, acqu); }; ActionBar.Tab tab4 = ActionBar.NewTab(); tab4.SetText("Grab"); tab4.TabSelected += (sender, e) => { // Do something when tab is selected e.FragmentTransaction.Replace(Android.Resource.Id.Content, grab); }; actionbar.AddTab(tab1); actionbar.AddTab(tab2); actionbar.AddTab(tab3); actionbar.AddTab(tab4); // tabhost = FindViewById<TabHost> (Resource.Id.tabhost);// .tabHost1); //CreateTab(typeof(Identification), "Identification", "Identification", Resource.Drawable.Icon); //CreateTab(typeof(Verify), "Verify", "Verify", Resource.Drawable.Icon); //CreateTab(typeof(Acquisition), "Acquisition", "Acquisition", Resource.Drawable.Icon); ////CreateTab(typeof(Desfire), "Desfire", "Desfire", Resource.Drawable.Icon); //CreateTab(typeof(Grab), "Grab", "Grab", Resource.Drawable.Icon); }
private Tab CreateTab(string name, string tag, string gaugeType, string size, Tab tab = null) { ActionBar.Tab aTab = ActionBar.NewTab(); aTab.SetText(name); if (tab == null) { tab = new Tab( name, aTab, name == "Total" ? new Trip(true) : trip); tabs.Add(tab); } else { tab.ActionBarTab = aTab; } tab.include = parser.GetValues(tag); if (name == "Eff") { tab.include = tab.include.OrderBy(x => x.unit.Trim()).ToList(); } tab.size = int.Parse(size); tab.style = int.Parse(gaugeType); if (name == "BMS") { tab.style = 3; } aTab.TabSelected += (sender, args) => { currentTab = tab; if (bluetoothHandler.active) { bluetoothHandler.ChangeFilter(currentTab.include); } ladapter.items = currentTab.GetItems(parser); ladapter.items.Any(x => x.selected = false); gridView1.NumColumns = currentTab.style == 0 ? 1 : currentTab.size; gridView1.Invalidate(); ladapter.NotifyChange(); if (!starting) { editor = prefs.Edit(); editor.PutString("currentTab", currentTab.name); editor.Commit(); } }; ActionBar.AddTab(aTab); return(tab); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); this.ActionBar.NavigationMode = ActionBarNavigationMode.Tabs; ActionBar.Tab tab = ActionBar.NewTab(); tab.SetText(Resources.GetString(Resource.String.setting_tab_name)); tab.SetIcon(Android.Resource.Drawable.IcMenuPreferences); tab.TabSelected += (sender, args) => { // Do something when tab is selected }; this.ActionBar.AddTab(tab); tab = ActionBar.NewTab(); tab.SetText(Resources.GetString(Resource.String.company_tab_name)); tab.SetIcon(Android.Resource.Drawable.IcMenuSave); tab.TabSelected += (sender, args) => { // Do something when tab is selected }; ActionBar.AddTab(tab); tab = ActionBar.NewTab(); tab.SetText(Resources.GetString(Resource.String.order_tab_name)); tab.SetIcon(Android.Resource.Drawable.IcMenuSearch); tab.TabSelected += (sender, args) => { // Do something when tab is selected }; ActionBar.AddTab(tab); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); // Get our button from the layout resource, // and attach an event to it Button button = FindViewById <Button> (Resource.Id.myButton); button.Click += delegate { button.Text = string.Format("{0} clicks!", count++); }; }
private void SetupTabs(SqliteConnection conn, Model.ModelLifeCounter model) { ActionBar.Tab tab = ActionBar.NewTab(); tab.SetText("Life"); tab.TabSelected += (sender, args) => { conn.UpdateLifeCounter(Translate(mainActivityModel)); SetContentView(Resource.Layout.LifeCounter); model = conn.GetLatestEntry(); SetupLifeMainView(Translate(model)); }; ActionBar.AddTab(tab); tab = ActionBar.NewTab(); tab.SetText("Poison"); tab.TabSelected += (sender, args) => { conn.UpdateLifeCounter(Translate(mainActivityModel)); SetContentView(Resource.Layout.layPoison); model = conn.GetLatestEntry(); SetupLifeMainView(Translate(model)); }; ActionBar.AddTab(tab); tab = ActionBar.NewTab(); tab.SetText("Commander"); tab.TabSelected += (sender, args) => { conn.UpdateLifeCounter(Translate(mainActivityModel)); SetContentView(Resource.Layout.layCommander); model = conn.GetLatestEntry(); SetupLifeMainView(Translate(model)); }; ActionBar.AddTab(tab); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.tablayout); ActionBar.NavigationMode = ActionBarNavigationMode.Tabs; ActionBar.SetDisplayShowTitleEnabled(false); ActionBar.Tab tab = ActionBar.NewTab(); tab.SetText("PieChart Stolen Brands"); tab.SetIcon(Resource.Drawable.piefix); tab.TabSelected += (sender, args) => { SetContentView(Resource.Layout.barChart); PlotView view = FindViewById <PlotView>(Resource.Id.plot_view_bar); CreatePieChart barchart = new CreatePieChart(); view.Model = barchart.CreatePlotModel(); }; ActionBar.AddTab(tab); tab = ActionBar.NewTab(); tab.SetText("Favorite Stolen Bike Colors"); tab.SetIcon(Resource.Drawable.piefix); tab.TabSelected += (sender, args) => { SetContentView(Resource.Layout.barChart); PlotView view = FindViewById <PlotView>(Resource.Id.plot_view_bar); CreatePieChart2 pieChart = new CreatePieChart2(); view.Model = pieChart.CreatePlotModel(); }; ActionBar.AddTab(tab); tab = ActionBar.NewTab(); tab.SetText("List for piecharts"); tab.TabSelected += (sender, args) => { var intent = new Intent(this, typeof(pielist)); StartActivity(intent); }; ActionBar.AddTab(tab); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); ActionBar.NavigationMode = ActionBarNavigationMode.Tabs; SetContentView(Resource.Layout.ReportsView); ActionBar.Tab tab = ActionBar.NewTab(); tab.SetText("Wydatki"); tab.TabSelected += delegate(object sender, ActionBar.TabEventArgs e) { e.FragmentTransaction.Replace(Resource.Id.showHost, new ShowExpensesFragment()); }; ActionBar.AddTab(tab); tab = ActionBar.NewTab(); tab.SetText("Przychody"); tab.TabSelected += delegate(object sender, ActionBar.TabEventArgs e) { e.FragmentTransaction.Replace(Resource.Id.showHost, new ShowIncomesFragment()); }; ActionBar.AddTab(tab); tab = ActionBar.NewTab(); tab.SetText("Raport"); tab.TabSelected += delegate(object sender, ActionBar.TabEventArgs e) { e.FragmentTransaction.Replace(Resource.Id.showHost, new ShowReportFragment()); }; ActionBar.AddTab(tab); }
protected override void OnCreate(Bundle savedInstance) { base.OnCreate(savedInstance); SetContentView(R.Layouts.ItemDetailActivity_Layout); var itemID = Intent.GetLongExtra("itemID", 0); var itemName = Intent.GetStringExtra("itemName"); this.ActionBar.SetTitle(itemName); this.ActionBar.NavigationMode = ActionBar.NAVIGATION_MODE_TABS; detailsFragment = new ItemDetailsTabFragment(null); detailsTab = this.ActionBar.NewTab(); detailsTab.SetText("Details"); detailsTab.SetTabListener(this); detailsTab.SetTag(detailsFragment); this.ActionBar.AddTab(detailsTab); stocksFragment = new ItemStationStockTabFragment(null); stockTab = this.ActionBar.NewTab(); stockTab.SetText("Stock"); stockTab.SetTabListener(this); stockTab.SetTag(stocksFragment); this.ActionBar.AddTab(stockTab); producersFragment = new ItemProducersTabFragment(null); producersTab = this.ActionBar.NewTab(); producersTab.SetText("Production"); producersTab.SetTabListener(this); producersTab.SetTag(producersFragment); this.ActionBar.AddTab(producersTab); if (itemID == 0) { Android.Widget.Toast.MakeText(this, "Item ID Error!", Android.Widget.Toast.LENGTH_LONG).Show(); } var itemDetail = LastNonConfigurationInstance as Item; if ((itemDetail != null) && (itemDetail.ItemID == itemID)) { _savedInstance = itemDetail; PopulateItemDetail(itemDetail); } else { RefreshItemDetail(itemID); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); activity = this; /*Creation of tabs.*/ ActionBar.NavigationMode = ActionBarNavigationMode.Tabs; ActionBar.Tab tab = ActionBar.NewTab(); //Tab for ñcals. tab.SetText(Resource.String.tab_ListAlcohol); tab.TabSelected += Tab_TabSelectedListAlcohol; ActionBar.AddTab(tab); //Tab for alcohol calendar. tab = ActionBar.NewTab(); tab.SetText(Resource.String.tab_CalendarAlcohol); tab.TabSelected += Tab_TabSelectedCalendarAlcohol; ActionBar.AddTab(tab); //Going to selected tab. SetContentView(Resource.Layout.helpform_ParametersConnector); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); activity = this; /*Creation of tabs.*/ ActionBar.NavigationMode = ActionBarNavigationMode.Tabs; ActionBar.Tab tab = ActionBar.NewTab(); //Tab for ProtsFatsCarbs. tab.SetText(Resource.String.tab_ProtsFatsCarbs); tab.TabSelected += Tab_TabSelectedProtsFatsCarbs; ActionBar.AddTab(tab); //Tab for WaterCcals. tab = ActionBar.NewTab(); tab.SetText(Resource.String.tab_WaterCcals); tab.TabSelected += Tab_TabSelectedWaterCcals; ActionBar.AddTab(tab); //Going to selected tab. SetContentView(Resource.Layout.helpform_ParametersConnector); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); activity = this; /*Creation of tabs.*/ ActionBar.NavigationMode = ActionBarNavigationMode.Tabs; ActionBar.Tab tab = ActionBar.NewTab(); //Tab for list of cigarettes. tab.SetText(Resource.String.tab_ListCigarettes); tab.TabSelected += Tab_TabSelectedList; ActionBar.AddTab(tab); //Tab for cigarettes calendar. tab = ActionBar.NewTab(); tab.SetText(Resource.String.tab_CalendarCigarettes); tab.TabSelected += Tab_TabSelectedCalendar; ActionBar.AddTab(tab); //Going to selected tab. SetContentView(Resource.Layout.helpform_CigarettesConnector); }
void TabSetup(ActionBar.Tab tab, int resourceId) { if (resourceId != 0) { //if (Droid.OS.Build.VERSION.SdkInt > Droid.OS.BuildVersionCodes.JellyBeanMr1) { // ImageView iv = new ImageView(activity); // iv.SetImageResource(resourceId); // iv.SetPadding(-25, 8, -25, 16); // tab.SetCustomView(iv); //} else { tab.SetIcon(resourceId); tab.SetText(""); //} } tab.TabSelected -= TabOnTabSelected; tab.TabSelected += TabOnTabSelected; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.tablayout); ActionBar.NavigationMode = ActionBarNavigationMode.Tabs; ActionBar.SetDisplayShowTitleEnabled(false); ActionBar.Tab tab = ActionBar.NewTab(); tab.SetText("LineChart"); tab.SetIcon(Resource.Drawable.linefix); tab.TabSelected += (sender, args) => { SetContentView(Resource.Layout.barChart); PlotView view = FindViewById <PlotView>(Resource.Id.plot_view_bar); CreateLineChart linechart = new CreateLineChart(); view.Model = linechart.CreatePlotModel(); }; ActionBar.AddTab(tab); }
void initTab() { scan_Fragment = new Scan_Fragment(); set_Fragment = new Set_Fragment(); write_Fragment = new Write_Fragment(); read_Fragment = new Read_Fragment(); actionBar = ActionBar; actionBar.NavigationMode = ActionBarNavigationMode.Tabs; actionBar.SetDisplayHomeAsUpEnabled(true); ActionBar.Tab tab1 = actionBar.NewTab(); tab1.SetTag("Scan"); tab1.SetText(Resource.String.tab_Scan); tab1.TabSelected += (object sender, ActionBar.TabEventArgs e) => { e.FragmentTransaction.Replace(Android.Resource.Id.Content, scan_Fragment); }; ActionBar.Tab tab2 = actionBar.NewTab(); tab1.SetTag("Write"); tab2.SetText(Resource.String.tab_WriteData); tab2.TabSelected += (object sender, ActionBar.TabEventArgs e) => { e.FragmentTransaction.Replace(Android.Resource.Id.Content, write_Fragment); }; ActionBar.Tab tab3 = actionBar.NewTab(); tab1.SetTag("Read"); tab3.SetText(Resource.String.tab_ReadData); tab3.TabSelected += (object sender, ActionBar.TabEventArgs e) => { e.FragmentTransaction.Replace(Android.Resource.Id.Content, read_Fragment); }; ActionBar.Tab tab4 = actionBar.NewTab(); tab1.SetTag("set"); tab4.SetText(Resource.String.tab_set); tab4.TabSelected += (object sender, ActionBar.TabEventArgs e) => { e.FragmentTransaction.Replace(Android.Resource.Id.Content, set_Fragment); }; actionBar.AddTab(tab1); actionBar.AddTab(tab2); actionBar.AddTab(tab3); actionBar.AddTab(tab4); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Screen2); ActionBar.NavigationMode = ActionBarNavigationMode.Tabs; ActionBar.Tab tab = ActionBar.NewTab(); tab.SetText("Home"); tab.TabSelected += (sender, args) => { Fragment frag1 = new PrincipalFragment(); var t = this.FragmentManager.BeginTransaction(); t.Replace(Resource.Id.frmFragment1, frag1); t.Commit(); Fragment frag = new MenuFragment(); this.FragmentManager.BeginTransaction().Replace(Resource.Id.frmFragment, frag).Commit(); }; ActionBar.AddTab(tab); ActionBar.Tab tab2 = ActionBar.NewTab(); tab2.SetText("Configuraciones"); tab2.TabSelected += (sender, args) => { Fragment frag1 = new MenuFragment(); this.FragmentManager.BeginTransaction().Replace(Resource.Id.frmFragment1, frag1).Commit(); Fragment frag = new PrincipalFragment(); var t = this.FragmentManager.BeginTransaction(); t.Replace(Resource.Id.frmFragment, frag); t.Commit(); }; ActionBar.AddTab(tab2); //AddTab("Favorites",new MenuFragment()); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); ActionBar.NavigationMode = ActionBarNavigationMode.Tabs; // create an Action bar SetContentView(Resource.Layout.TabLayout_Layout); // set out layout ActionBar.Tab t1 = ActionBar.NewTab(); t1.SetText("One"); t1.TabSelected += T1_TabSelected; ActionBar.AddTab(t1); ActionBar.Tab t2 = ActionBar.NewTab(); t2.SetText("Two"); t2.TabSelected += T2_TabSelected; ActionBar.AddTab(t2); ActionBar.Tab t3 = ActionBar.NewTab(); t3.SetText("Three"); t3.TabSelected += T3_TabSelected; ActionBar.AddTab(t3); }
private void AddTab(string tabText, int iconResourceId, Fragment view) { ActionBar.Tab tab = ActionBar.NewTab(); tab.SetText(tabText); tab.SetIcon(iconResourceId); tab.TabSelected += delegate(object sender, ActionBar.TabEventArgs e) { Fragment fragment = FragmentManager.FindFragmentById(Resource.Id.fragmentContainer); if (fragment != null) { e.FragmentTransaction.Remove(fragment); } e.FragmentTransaction.Add(Resource.Id.fragmentContainer, view); }; tab.TabUnselected += delegate(object sender, ActionBar.TabEventArgs args) { args.FragmentTransaction.Remove(view); }; ActionBar.AddTab(tab); }