private void CreateTab(Type activityType, string tag, string label, TabHost tabHost) { Intent intent = new Intent(this, activityType); intent.AddFlags(ActivityFlags.NewTask); TabSpec spec = tabHost.NewTabSpec(tag); spec.SetIndicator(label, this.GetDrawable(Android.Resource.Drawable.IcMenuManage)); spec.SetContent(intent); tabHost.AddTab(spec); }
private void InitializeTabs() { tabHost = this.mActivity.FindViewById <TabHost>(Resource.Id.tabHost); tabHost.Setup(); View tabIndicator = this.mActivity.LayoutInflater.Inflate(Resource.Layout.tab_indicator, tabHost.TabWidget, false); (tabIndicator.FindViewById <TextView>(Android.Resource.Id.Title)).Text = "Network Devices"; (tabIndicator.FindViewById <ImageView>(Android.Resource.Id.Icon)).SetImageResource(Resource.Mipmap.baseline_router_black_48); View tabIndicator2 = this.mActivity.LayoutInflater.Inflate(Resource.Layout.tab_indicator, tabHost.TabWidget, false); (tabIndicator2.FindViewById <TextView>(Android.Resource.Id.Title)).Text = "RTSP Servers"; (tabIndicator2.FindViewById <ImageView>(Android.Resource.Id.Icon)).SetImageResource(Resource.Mipmap.baseline_playlist_play_black_48); spec1 = tabHost.NewTabSpec("Tab1"); spec1.SetContent(Resource.Id.tab1); spec1.SetIndicator(tabIndicator); spec2 = tabHost.NewTabSpec("Tab2"); spec2.SetIndicator(tabIndicator2); spec2.SetContent(Resource.Id.tab2); tabHost.AddTab(spec1); tabHost.AddTab(spec2); }