0

我想在 TabWidget 的右端添加一个按钮。TabWidget 位于 Horizo​​ntalScrollView 内(在代码中添加),但 Button 不应与选项卡一起滚动,而是始终保持在选项卡栏的右侧。

我不确定是否可以通过这种方式自定义 TabWidget,因此另一个想法是将这样的 Button 放置在TabWidget旁边。

我用以下布局尝试了这个,但 TextView 没有出现。所以对我来说问题是,它通常是可行的,还是我需要不同的方法?

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.app.FragmentTabHost
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/content_tabhost"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="horizontal" >

        <TabWidget
            android:id="@android:id/tabs"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"/>


        <TextView
            android:id="@+id/tab_search"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="SEARCH HERE"/>

    </LinearLayout>

    <FrameLayout
        android:id="@+id/content_body"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>
</LinearLayout>

</android.support.v4.app.FragmentTabHost>
4

0 回答 0