6

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.

Avijit
  • 3,796
  • 4
  • 31
  • 44
OnDWay
  • 109
  • 3
  • 11
  • 2
    I opened a bug-report, please vote on it: https://code.google.com/p/android/issues/detail?id=78772 – Gavriel Nov 05 '14 at 21:36

2 Answers2

0

As I think you have to surround the LinearLayout with TabHost

Maybe also this helps you How do I use 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.

Community
  • 1
  • 1
Fraggles
  • 433
  • 4
  • 20
  • Threre is a java code http://www.vogella.com/code/ApiDemos/src/com/example/android/apis/app/FragmentTabsFragment.html but i could not find the layout where I am getting the error. – OnDWay Jan 22 '14 at 04:36
0
 <TabWinget android:id="@+id/tabhost"

should be changed to:

 <TabWidget android:id="@android:id/tabhost"
onuriltan
  • 2,682
  • 2
  • 13
  • 26