protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.LiveScoreTab); Console.WriteLine("LiveScoreTabActivity"); CreateTab(typeof(TodayLiveScoreActivity), "today", "Today", Resource.Drawable.livescore_state); TabHost.SetCurrentTabByTag("today"); TabChangerListener.setTabColor(TabHost); TabHost.TabWidget.GetChildAt(0).Click += (object sender, EventArgs e) => { isSelected(0); setColor(TabHost); TabHost.SetCurrentTabByTag("yesterday"); }; TabHost.TabWidget.GetChildAt(1).Click += (object sender, EventArgs e) => { isSelected(1); setColor(TabHost); TabHost.SetCurrentTabByTag("today"); }; // Create your application here }
private void CreateTab(Type activityType, string tag, string label, int drawableId) { var intent = new Intent(this, activityType); //intent.AddFlags(ActivityFlags.NewTask); intent.AddFlags(ActivityFlags.ClearTop); var spec = TabHost.NewTabSpec(tag); var drawableIcon = Resources.GetDrawable(drawableId); spec.SetIndicator(label, drawableIcon); spec.SetContent(intent); TabHost.AddTab(spec); TabChangerListener.setTabColor(TabHost); }