【发布时间】:2014-01-05 20:06:38
【问题描述】:
我想用 tabhost 做应用程序。每个选项卡都有其他布局。在每个布局中我都想使用其他活动。可能吗?怎么做?
我做过这样的事情:
myTabHost =(TabHost) findViewById(R.id.TabHost);
myTabHost.setup(this.getLocalActivityManager());
// Adding tabs
// tab1 settings
TabSpec spec = myTabHost.newTabSpec("tab_creation");
spec.setIndicator("Strona główna",getResources().getDrawable(android.R.drawable.ic_menu_add));
Intent i = new Intent().setClass(this, WelcomeActivity.class);
spec.setContent(i);
myTabHost.addTab(spec);
// otherwise :
Intent j = new Intent().setClass(this, DrugsActivity.class);
myTabHost.addTab(myTabHost.newTabSpec("tab_inser").setIndicator("Lista leków",getResources().getDrawable(android.R.drawable.ic_menu_edit)).setContent(j));
Intent k = new Intent().setClass(this, SymptomsActivity.class);
myTabHost.addTab(myTabHost.newTabSpec("tab_affiche").setIndicator("Objawy",getResources().getDrawable(android.R.drawable.ic_menu_view)).setContent(k));
myTabHost.setCurrentTab(0);
但现在看起来该应用程序在一个屏幕上向我显示了每个布局。它们是重叠的......我不知道要改变什么,因为我刚开始用 android&java 冒险。谁能帮帮我?
【问题讨论】:
标签: android android-layout tabs android-tabhost