Can I embed Tab Layout into other layout?
Can I embed Tab Layout into other layout?
The designed layout is li开发者_如何学Pythonke below:
Root LinearLayout (vertical oritentation)
A ViewLayout
A TextLayout
A Tab layout
A View Layout
A TextLayout
I just want to have tabs in my layout but not the root. Is it possible?
Thanks.
Your problem is that the tabHost isn't root. See this code - it puts the element above the tabs...
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@android:id/tabhost"
style="@style/page" >
<RelativeLayout style="@style/page" >
<RelativeLayout
android:id="@+id/rell"
android:layout_width="360dp"
android:layout_height="66dp" >
<ImageView
android:layout_width="211dp"
android:layout_height="64dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:src="@drawable/semple_img" />
</RelativeLayout>
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="61dp"
android:layout_below="@id/rell">
</TabWidget>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@android:id/tabs" >
</FrameLayout>
</RelativeLayout>
</TabHost>
Yes, it's possible. In your xml you simply put the tabhost wherever you want it. You're having difficulties with the xml?
精彩评论