1.布局文件自定义tabhost的id属性
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TabHost
android:id="@+id/mytabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
2.让自定义的Activity继承ActivityGroup
public class MainTabActivity extends ActivityGroup
// 获取TabHost对象
TabHost tabHost = (TabHost) findViewById(R.id.mytabhost);
// 如果没有继承TabActivity时,通过该种方法加载启动tabHost
tabHost.setup(this.getLocalActivityManager());
完成以上三步便可不用继承TabActivity,来实现TabActivity布局