<TabHost
android:id="@+id/myTabHost"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TabWidget
android:id="@android:id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0"
android:orientation="horizontal" />
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0" >
<TextView
android:id="@+id/view1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Tab1 Content"
/>
<TextView
android:id="@+id/view2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Tab2 Content" />
<TextView
android:id="@+id/view3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Tab3 Content" />
</FrameLayout>
</LinearLayout>
</TabHost>
TabHost tabHost = (TabHost) findViewById(R.id.myTabHost);
tabHost.setup();
tabHost.addTab(tabHost.newTabSpec("tag01").
setIndicator("tag01 title",getResources().
getDrawable(R.drawable.ic_launcher)).
setContent(R.id.view1));
tabHost.addTab(tabHost.newTabSpec("tag02").setIndicator("tag02 title").setContent(R.id.view2));
tabHost.addTab(tabHost.newTabSpec("tag03").setIndicator("tag03 title").setContent(R.id.view3));