我使用的標籤主機在我的應用程序爲:如何刪除選項卡中的Android活動
當我我移動到另一個活動的任何選項卡上單擊如下:
我想刪除標籤從屏幕上點擊除主選項卡按鈕以外的任何選項卡。以下是我的代碼:
public class MainActivity extends TabActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
try{
Resources ressources = getResources();
TabHost tabHost = getTabHost();
// Main tab
Intent intentAndroid = new Intent().setClass(this, DasashboardActivity.class);
TabSpec tabSpecAndroid = tabHost
.newTabSpec("Main")
.setIndicator("Main", ressources.getDrawable(R.drawable.ic_launcher))
.setContent(intentAndroid);
tabHost.clearAllTabs();
// Log tab
Intent intentApple = new Intent().setClass(this, LogActivity.class);
TabSpec tabSpecApple = tabHost
.newTabSpec("Log")
.setIndicator("Log", ressources.getDrawable(R.drawable.ic_action_email))
.setContent(intentApple);
// Settings tab
Intent intentWindows = new Intent().setClass(this, SettingsActivity.class);
TabSpec tabSpecWindows = tabHost
.newTabSpec("Settings")
.setIndicator("Settings", ressources.getDrawable(R.drawable.ic_action_brightness_high))
.setContent(intentWindows);
// Help tab
Intent intentBerry = new Intent().setClass(this, HelpActivity.class);
TabSpec tabSpecBerry = tabHost
.newTabSpec("Help")
.setIndicator("Help", ressources.getDrawable(R.drawable.ic_action_help))
.setContent(intentBerry);
// add all tabs
tabHost.addTab(tabSpecAndroid);
tabHost.addTab(tabSpecApple);
tabHost.addTab(tabSpecWindows);
tabHost.addTab(tabSpecBerry);
//set Windows tab as default (zero based)
tabHost.setCurrentTab(0);
}
catch(Exception ex)
{
Log.e("ERROR in Log class", ex.toString());
}
}
}
如何從其他已啓動的活動中刪除選項卡?
重量ü要才達到? – Sush