I have been using the fragment tab host for some time and it was working fine. Suddenly i am getting this layout compilation error.
我已经使用片段标签主机一段时间了,它工作正常。突然间我得到了这个布局编译错误。
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>
Please don't close it as duplicate as I checked all threads but I was not able to solve this.
请不要将它关闭,因为我检查了所有线程,但我无法解决这个问题。
2 个解决方案
#1
0
As I think you have to surround the LinearLayout
with TabHost
我认为你必须使用TabHost包围LinearLayout
Maybe also this helps you How do I use tabHost for Android
也许这对你有帮助我如何使用tabHost for Android
The Vogella Tab Tutorial as linked in the other topic, works great and I'm using it in my app at the moment.
Vogella Tab Tutorial在其他主题中链接,效果很好,我现在正在我的应用程序中使用它。
#2
0
<TabWinget android:id="@+id/tabhost"
should be changed to:
应改为:
<TabWidget android:id="@android:id/tabhost"
#1
0
As I think you have to surround the LinearLayout
with TabHost
我认为你必须使用TabHost包围LinearLayout
Maybe also this helps you How do I use tabHost for Android
也许这对你有帮助我如何使用tabHost for Android
The Vogella Tab Tutorial as linked in the other topic, works great and I'm using it in my app at the moment.
Vogella Tab Tutorial在其他主题中链接,效果很好,我现在正在我的应用程序中使用它。
#2
0
<TabWinget android:id="@+id/tabhost"
should be changed to:
应改为:
<TabWidget android:id="@android:id/tabhost"