Android TabActivity使用
java代码:mTabHost = getTabHost();
mTabHost.setup();
mTabHost.addTab(mTabHost
.newTabSpec("Home")
.setIndicator(indicator1)
.setContent(new Intent(this, Home.class)));
mTabHost.setCurrentTab(0);// 选择第0个选项卡
xml布局
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
tools:ignore="UselessParent" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="match_parent" >
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="52dp"
android:background="@drawable/layer_list_home_tab_gb"
android:layout_alignParentBottom="true" >
</TabWidget>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@android:id/tabs" >
</FrameLayout>
</RelativeLayout>
</TabHost>