0
實施Tabs Widget Sample後,我試着只改變到第二個選項卡MonoDroid的標籤查看
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Main);
TabHost.TabSpec spec;
spec = TabHost.NewTabSpec("tab_test1").SetIndicator("TAB 1").SetContent(Resource.Id.textview1);
TabHost.AddTab(spec);
spec = TabHost.NewTabSpec("tab_test2").SetIndicator("TAB 2").SetContent(Resource.Id.textview2);
TabHost.AddTab(spec);
//spec = TabHost.NewTabSpec("tab_test3").SetIndicator("TAB 3").SetContent(Resource.Id.widget0);
//TabHost.AddTab(spec);
TabHost.TabChanged += new EventHandler<Android.Widget.TabHost.TabChangeEventArgs>(TabHost_TabChanged);
TabHost.CurrentTab = 0;
}
void TabHost_TabChanged(object sender, TabHost.TabChangeEventArgs e)
{
if (TabHost.TabWidget.TabCount < 3)
{
TabHost.TabSpec spec;
spec = TabHost.NewTabSpec("tab_test3").SetIndicator("TAB 3").SetContent(Resource.Id.widget0);
TabHost.AddTab(spec);
}
}
的問題後,用它玩,並添加第三個選項卡是我看到的第一個第三視圖疊加-ED即使第三個標籤僅在點擊第二個標籤後纔出現,在點擊標籤之前查看。這是怎麼回事?
是的,做的工作。謝謝克里斯。 – Shy