我的代码: tabHost = getTabHost(); getTabHost()无效();
tabHost.addTab(tabHost.newTabSpec("tab1")
.setIndicator("", getResources().getDrawable(R.drawable.home))
.setContent(new Intent(this, Home.class)));
tabHost.addTab(tabHost.newTabSpec("tab2")
.setIndicator("", getResources().getDrawable(R.drawable.trip))
.setContent(new Intent(this, Tript.class)));
tabHost.addTab(tabHost
.newTabSpec("tab3")
.setIndicator("",
getResources().getDrawable(R.drawable.settings))
.setContent(new Intent(this, Settings.class)));
tabHost.setCurrentTab(0);
我现在已经解决了以下问题:
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
答案 0 :(得分:1)
只需像这样使用.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
tabHost.addTab(tabHost.newTabSpec("Your Tab")
.setIndicator("tab indicator")
.setContent(new Intent(this, TabClass.class)
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)));