<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginTop="5dp" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="0.9" />
<!-- 将tabhost的tabcontent隐藏,用viewPage填充 -->
<FrameLayout
android:id="@android:id/tabcontent"
android:visibility="gone"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</FrameLayout>
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="0.1" >
</TabWidget>
</LinearLayout>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginTop="5dp" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="0.9" />
<!-- 将tabhost的tabcontent隐藏,用viewPage填充 -->
<FrameLayout
android:id="@android:id/tabcontent"
android:visibility="gone"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</FrameLayout>
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="0.1" >
</TabWidget>
</LinearLayout>
</TabHost>
TabHost tb=findViewById(R.id.tabhost);
TabWeight tbweight=findVIewById(android.R.id.tabs)