的基本概念如下
TabHost
是一個標籤式窗口視圖的容器。 此對象包含兩個子項:用戶單擊以選擇特定選項卡的一組選項卡標籤,以及顯示該頁面內容的FrameLayout對象。
單個元素通常使用此容器對象進行控制,而不是在子元素本身上設置值。
TabWidget
顯示錶示父級選項卡集合中每個頁面的選項卡標籤列表。這個小部件的容器對象是TabHost。 當用戶選擇一個選項卡時,該對象向容器TabHost發送一條消息,告訴切換顯示頁面。容器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" >
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1" >
</FrameLayout>
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="-3dip"
android:layout_weight="0" >
</TabWidget>
</LinearLayout>
</TabHost>
請花幾秒鐘的搜索現有的問題。同樣的問題被問*昨天*:http://stackoverflow.com/questions/2395661/android-tabs-at-the-bottom – 2010-03-08 13:59:31
我認爲克里斯托弗的觀點是,如果人們無法回答其他人的問題,他們可能也無法回答你的問題。換句話說,不需要再次提出這個問題,而是應該嘗試向其他地方尋找。 – 2010-03-08 15:17:47
由於這個問題是重複的,我將簡單地鏈接到關於另一個問題的完整答案。 [http://stackoverflow.com/questions/2395661/android-tabs-at-the-bottom/2710404#2710404](http://stackoverflow.com/questions/2395661/android-tabs-at-the-bottom/ 2710404#) – stormin986 2010-04-25 23:44:02