这是我创建的 Tabhost
public class AppTabhost extends TabActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
/**find tab host**/
TabHost tabHost = getTabHost();
/**add tabs**/
//tab 1
tabHost.addTab(tabHost
.newTabSpec("tab1")
.setIndicator("tab1")
.setContent(new Intent(AppTabhost.this, anotherActivity.class)));
//tab 2
tabHost.addTab(tabHost
.newTabSpec("tab2")
.setIndicator("tab2")
.setContent(new Intent(AppTabhost.this, theotherActivity.class)));
}
我想把这两个Tab放在程序中每个Activity的底部。
怎么设置啊?
你可以设置一个intent,比如:Intent I= new Intent(this, Apptabhost.class); startIntent(I);
我建议定义一个tabhost的继承类,不是tabhost activity。
因为view hiarchy包含view而不是activities。
TabHost包括选项卡和每个选项卡对应的内容
楼主你确定是要把整个TabHost放在底部? 还是每个Activity的底部?
还是要在底部弄个公用的选项卡?
你弄错了 不是把tabhost放在每个activity底部 而是把每个activity放在tabhost里面