选项卡异常消息

Koo*_*per 0 android

06-14 00:21:30.398:ERROR/AndroidRuntime(332):引起:java.lang.RuntimeException:您的内容必须有一个TabHost,其id属性为'android.R.id.tabhost'

这是什么意思?我已经给了tabhost的id.我可以在R.java中看到id.

这是.xml:

<TabHost
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+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="@+id/tabs"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" />

        <FrameLayout
            android:id="@+id/tabcontent"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:padding="5dp" />
    </LinearLayout>
</TabHost>
Run Code Online (Sandbox Code Playgroud)

Com*_*are 6

如果您打算使用TabActivity,则需要使用您@android:id/tabhostandroid:idTabHost.