2010-08-04 20 views
1

我需要有一個佈局,其上方有一組標籤。我已經得到了標籤工作正常,但只要我嘗試在他們之外添加一個視圖,我留下了該視圖,沒有可見的選項卡。如何讓Android標籤與其他視圖共存?

這工作得很好:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 
    <TabHost 
     android:id="@android:id/tabhost" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:layout_weight="1"> 
     <LinearLayout ... /> 

但這並不:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 
    <TextView ... /> <!-- THIS LINE HERE!!! --> 
    <TabHost 
     android:id="@android:id/tabhost" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:layout_weight="1"> 
     <LinearLayout ... /> 

我能做些什麼讓我的卡口與其他視圖共存嗎?


爲了完整起見,我的活動擴展了TabActivity

回答

0

實際上,根據this article,這是不可能的。格兒。

0

Mayby你應該擺脫最初的LinearLayout並從你的tabhost開始,像這樣的tutorial?或者你的目標是像下面的圖片一樣設置?

+-----------------+ 
| App Title  | 
+-----------------+ 
| some text  | 
+-----+-----+-----+ 
| tab | tab | tab | 
+-----+-----+-----+ 
|     | 
+0

是的,那是我的目標。 – 2010-08-04 10:38:42