你的TabHost必须有一个TabWidget,其id属性是'android.R.id.tabs'

时间:2012-09-08 17:51:40

标签: java android xml eclipse

当我尝试设置我的TabHost时,我得到一个异常,因为:“你的TabHost必须有一个TabWidget,其id属性是'android.R.id.tabs'”

我在我的xml文件中恢复了最小标签Host / widget和FrameLayout的示例(使用Tabwidget使用android:id =“@ android:id / tabs”)我试过清理我的项目,删除我的R文件,重新启动eclipse和我的机器(OSX Lion,indigo,r20)但这个错误不断回归。欢迎任何提示。 TIA

这是我的XML代码:

<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:padding="5dp">
    <TabWidget
        android:id="@android:id/tabs"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" />
    <FrameLayout
        android:id="@android:id/tabcontent"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:padding="5dp" />
</LinearLayout>
</TabHost>

0 个答案:

没有答案