开发者

How to display buttons above tab widget on Android?

开发者 https://www.devze.com 2023-01-08 18:17 出处:网络
I\'m trying to add buttons above a tab-widget but they are always displayed under the tab-widget\'s tabs. The buttons are displayed on front layer so that they appear on each tab.

I'm trying to add buttons above a tab-widget but they are always displayed under the tab-widget's tabs. The buttons are displayed on front layer so that they appear on each tab.

Does anybody have an idea is it possible at all to display any widgets above the tab-widget?

Here's an example layout to give some idea on the placement of the widgets. Note: this layout is not functional.

<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开发者_Go百科_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"/>


according to resources at developer.android.com

The TabHost must be the root node for the layout, which contains both the TabWidget for displaying the tabs and a FrameLayout for displaying the tab content.

so I think you can not do that, nor would it look nice, imho.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号