的活性及第二的一个选项卡我想有一个TabHost
它由两个选项卡:一个从View
(R.id.something
)创建并从Activity
第二个。TabHost:视图
所以我是这样做的:
mTab = (TabHost) findViewById(R.id.tabhost);
mTab.setup();
TabHost.TabSpec spec = mTab.newTabSpec("All");
spec.setContent(R.id.all_tab); // Created from View
spec.setIndicator("All", getResources().getDrawable(R.drawable.emo_im_cool));
mTab.addTab(spec);
Intent intent = new Intent().setClass(this, TasksDone.class);
spec = mTab.newTabSpec("Done");
spec.setIndicator("Done", getResources().getDrawable(R.drawable.emo_im_happy));
spec.setContent(intent); // Created from Intent
mTab.addTab(spec);
之后,第一个选项卡上的内容是不可见的,但它的存在,因为我看到我的点击反应。
但出现如果我设置第二个选项卡的setContent
为View
,而不是intent
。
你们知道为什么第一页上的内容是不可见的吗?
你的意思是标签“全部”不显示? – 2011-04-10 17:07:08
标签显示“全部”,但它的内容不是。 – Eugene 2011-04-10 17:26:13