0

我正在 TabHost 上方创建一个自定义栏。由于某种原因,自定义栏不会出现在 TabHost 上方,而是绘制在其后面。不知道为什么。这是我的 XML:

<?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_height="wrap_content" android:layout_width="match_parent" android:id="@+id/actionbarRelativeLayout">
        <ImageButton android:layout_height="wrap_content" android:layout_width="wrap_content" android:src="@drawable/icon" android:id="@+id/stocktwitsImageButton"></ImageButton>
        <ImageButton android:layout_height="wrap_content" android:layout_width="wrap_content" android:src="@drawable/icon" android:id="@+id/composeImageButton" android:layout_alignParentRight="true"></ImageButton>
    </RelativeLayout>
-->

    <LinearLayout
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:padding="5dp">
        <TabWidget
            android:id="@android:id/tabs"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" />
        <FrameLayout
            android:id="@android:id/tabcontent"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:padding="5dp" />
    </LinearLayout>
</TabHost>
4

1 回答 1

2

不要TabHost用作布局的根。把你的TabHost里面一个LinearLayoutwith orientation:vertical

然后在里面LinearLayout和之前TabHost,你可以把你的ActionBar。

于 2011-05-03T23:10:19.403 回答