Reputation: 738
I have some information which I want to show in a cascading style, and would prefer to show it in tab way.
So my idea is to have a TabHost embedded into one tab of another parent TabHost.
I can have one layer of TabHost working, but when I tried to add another TabHost into one of the tab, it always given an error of:
No resource found that matches the given name (at 'id' with value '@android:id/tabhostDiagnosis
Anyone faced the same problem before?
Here is my code (removed the redundant part)
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android: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">
<TabWidget android:id="@android:id/tabs"
android:layout_width="fill_parent" android:layout_height="wrap_content" />
<FrameLayout android:id="@android:id/tabcontent"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:id="@+id/Diagnosis">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<!-- -->
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhostDiagnosis"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout android:orientation="vertical"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<!-- -->
<TabWidget android:id="@android:id/tabsDiagnosis"
android:layout_width="fill_parent" android:layout_height="wrap_content" />
<FrameLayout android:id="@android:id/tabcontentDiagnosis"
android:layout_width="fill_parent" android:layout_height="fill_parent">
</FrameLayout>
</LinearLayout>
</TabHost>
</LinearLayout>
</ScrollView>
</FrameLayout>
</LinearLayout>
</TabHost>
Upvotes: 1
Views: 415
Reputation: 738
I studied the source code for TabHost.
It will reference the TabWidget (or FrameLayout) directly by the R.id.x.
mTabWidget = (TabWidget) findViewById(com.android.internal.R.id.tabs);
This basically stops from having TabHost embedded into another one.
So the answer is it will not work.
Upvotes: 1
Reputation: 5071
Winston is correct but ...
You can initiate another activity upon tab selection which can instantiate a new TabHost / TabWidget etc.
Upvotes: 0