2010-07-21 88 views
0

我試圖添加一個tab-widget上方的按鈕,但它們總是顯示在tab-widget的選項卡下。按鈕顯示在前面的圖層上,以便它們出現在每個選項卡上。如何在Android上的標籤小部件上方顯示按鈕?

有沒有人有一個想法是否有可能在tab-widget之上顯示任何小部件?

下面是一個示例佈局,以提供有關小部件放置的一些想法。注意:此佈局不起作用。

<ImageButton 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:src="@android:drawable/sym_action_chat" /> 

<ImageButton 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:src="@android:drawable/sym_action_email" /> 


<TextView android:id="@+id/view1" 
    android:background="@drawable/blue" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:text="@string/tabs_1_tab_1"/> 

<TextView android:id="@+id/view2" 
    android:background="@drawable/red" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:text="@string/tabs_1_tab_2"/> 

<TextView android:id="@+id/view3" 
    android:background="@drawable/green" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:text="@string/tabs_1_tab_3"/> 

回答

1

根據resources at developer.android.com

的TabHost必須爲佈局,它包含兩個TabWidget用於顯示的選項卡和用於顯示的標籤的內容的的FrameLayout根節點。

所以我認爲你不能這樣做,也不會看起來不錯,恕我直言。

+0

嗯。據說,我仍然懷疑是否可以將tabWidget放在一個線性佈局中,並用一些按鈕定義另一個線性佈局:我猜想是非常黑客。 – 2010-07-21 13:07:57

相關問題