【问题标题】:Fragment tab host error:Exception raised during rendering: No tab known for tag null片段选项卡主机错误:渲染期间引发异常:没有已知标签为空的选项卡
【发布时间】:2014-01-21 06:13:20
【问题描述】:

我已经使用片段选项卡主机一段时间了,它工作正常。 突然我得到这个布局编译错误。

Exception raised during rendering: No tab known for tag null

activity_tabhost_search.xml:

<android.support.v4.app.FragmentTabHost 
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:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <TabWidget
        android:id="@android:id/tabs"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="0"
        android:orientation="horizontal" />

     <FrameLayout
        android:id="@android:id/tabcontent"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1" />
</LinearLayout>

</android.support.v4.app.FragmentTabHost>

请不要关闭它,因为我检查了所有线程但我无法解决这个问题。

【问题讨论】:

标签: android android-fragments fragment-tab-host


【解决方案1】:

我认为你必须用TabHost包围LinearLayout

也许这也可以帮助你How do I use tabHost for Android

另一个主题中链接的 Vogella 选项卡教程效果很好,我目前正在我的应用程序中使用它。

【讨论】:

【解决方案2】:
 <TabWinget android:id="@+id/tabhost"

应该改为:

 <TabWidget android:id="@android:id/tabhost"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多