<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/layout_full"
android:orientation="vertical" >
<TabHost
android:id="@+id/tabhost"
style="@style/layout_full" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="0.0dip"
android:layout_weight="1.0" >
<LinearLayout
android:id="@+id/linearlayout"
style="@style/layout_full"
android:orientation="vertical" >
<fragment
android:id="@+id/content_fragment_top"
android:name="com.example.fragmenttest.TopBarFragment"
style="@style/layout_vertical"
android:layout_weight="1" />
<fragment
android:id="@+id/content_fragment"
android:name="com.example.fragmenttest.Contentfragment"
style="@style/layout_vertical"
android:layout_weight="8" />
</LinearLayout>
</FrameLayout>
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:visibility="gone" />
<FrameLayout
android:id="@android:id/tabcontent"
style="@style/layout_vertical"
android:layout_height="wrap_content" >
<RelativeLayout
android:id="@+id/layout_bottom"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<RadioGroup
android:id="@+id/radiogroup"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="@drawable/bottombg"
android:gravity="center_vertical"
android:orientation="horizontal" >
<RadioButton
android:id="@+id/radio_news"
android:layout_width="wrap_content"
android:background="@drawable/tab_selector_news"
android:button="@null"
android:checked="true" />
<RadioButton
android:id="@+id/radio_topic"
android:layout_width="wrap_content"
android:background="@drawable/tab_selector_topic"
android:button="@null" />
<RadioButton
android:id="@+id/radio_pic"
android:layout_width="wrap_content"
android:background="@drawable/tab_selector_pic"
android:button="@null" />
<RadioButton
android:id="@+id/radio_follow"
android:layout_width="wrap_content"
android:background="@drawable/tab_selector_follow"
android:button="@null" />
<RadioButton
android:id="@+id/radio_vote"
android:layout_width="wrap_content"
android:background="@drawable/tab_selector_vote"
android:button="@null" />
</RadioGroup>
</RelativeLayout>
</FrameLayout>
</LinearLayout>
</TabHost>
</LinearLayout>
以下是添加所需要fragment
<fragment
android:id="@+id/content_fragment_top"
android:name="com.example.fragmenttest.TopBarFragment"
style="@style/layout_vertical"
android:layout_weight="1" />
<fragment
android:id="@+id/content_fragment"
android:name="com.example.fragmenttest.Contentfragment"
style="@style/layout_vertical"
android:layout_weight="8" />
转载于:https://blog.51cto.com/androidniou/1078214