先上效果图
本例子是对TabHost组件的自定义,实现标签居底显示;每个标签包含图片和文字。
布局文件
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#F8FFEE" >
<!-- 内容显示 -->
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/text1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="@string/text1"
android:textSize="32dp" />
<TextView
android:id="@+id/text2"
android:layout_width="fill_parent"
and