的活性及第二的一個選項卡我想有一個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