I used below code and it is not render graphical layout. display error as Exception raised during rendering: No tab known for tag null
.
how can i solve this ?
<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="0dp"
android:layout_height="0dp"
android:layout_weight="0" />
<FrameLayout
android:id="@+id/realtabcontent"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
</LinearLayout>
</android.support.v4.app.FragmentTabHost>
I met this problem, researched, but could not found any working solution. But I notice that when I add a tab right after 'FragmentTabHost#setup', this problem does not occur, but for example, when I add a tab in 'AsyncTask#onPostExecute', this problem occurs. This seems stupid, but I tried, it is.. Based on those, I found a solution:
Adding an empty tab right after 'FragmentTabHost#setup', and then adding other tabs anywhere, I tried this solution, it works! I will the layout and partial codes below: