0
我正在嘗試爲其他開發人員創建模板/ BaseActivity類,以作爲框架的一部分使用。庫項目中的TabActivity,未找到android.R.id.tabhost錯誤
我伸出我的類TabActivity,和我的XML看起來像這樣/
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost" android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout android:orientation="vertical"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<View android:layout_width="fill_parent" android:layout_height="0dip"
android:background="#000" />
<TabWidget android:id="@android:id/tabs"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_marginLeft="0dip" android:layout_marginRight="0dip" />
<View android:layout_width="fill_parent" android:layout_height="2dip"
android:background="#696969" />
<View android:layout_width="fill_parent" android:layout_height="1dip"
android:background="#fff" />
<FrameLayout android:id="@android:id/tabcontent"
android:layout_width="fill_parent" android:layout_height="fill_parent" />
</LinearLayout>
</TabHost>
,當我在其他項目中擴大使用此活動,我得到一個錯誤,說明,它沒有能夠得到機器人。 R.id.tabhost,這是必要的。
發生這種情況,即使我調用getTabHost()或findViewById()這兩種情況。
請注意:我試過這個沒有擴展TabActivity,在tab中使用視圖。它工作正常。但我想使用活動作爲我的標籤內容。
我認爲這是我們製作圖書館項目並將其納入的問題。
請讓我知道如果您需要更多的解釋或如果你知道一些解決方法,請建議。
我面臨着同樣的問題,我希望看到更多的細節或者你如何解決它的代碼示例。 – Hermit 2012-04-11 12:45:55