Android标签:我可以在标签旁边放一些东西并自定义标签样式吗?

Android标签:我可以在标签旁边放一些东西并自定义标签样式吗?,android,android-actionbar,android-tabs,Android,Android Actionbar,Android Tabs,我正在尝试创建不填充整个宽度的选项卡 我目前使用的是ActionBar标签,并且刚刚制作了蓝色+a标签,但不幸的是,它将其拉伸,使其宽度相等 是否有任何方法可以使用操作栏选项卡执行此操作?如果没有,我可以使用TabHost/TabWidget吗?我希望页面的内容是控制实际页面内容的ViewPager 我当前的XML文件看起来很简单,如下所示: <?xml version="1.0" encoding="utf-8"?> <android.support.v4.view.View

我正在尝试创建不填充整个宽度的选项卡

我目前使用的是ActionBar标签,并且刚刚制作了蓝色+a标签,但不幸的是,它将其拉伸,使其宽度相等

是否有任何方法可以使用操作栏选项卡执行此操作?如果没有,我可以使用TabHost/TabWidget吗?我希望页面的内容是控制实际页面内容的ViewPager

我当前的XML文件看起来很简单,如下所示:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.view.ViewPager
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/pager"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

当我尝试TabHost时,我尝试了以下方法:

<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"
     android:id="@android:id/tabhost">

    <LinearLayout 
            android:id="@+id/LinearLayout01"
            android:orientation="vertical" 
            android:layout_height="fill_parent"
            android:layout_width="fill_parent">

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

          <TabWidget 
                android:id="@android:id/tabs"
                android:layout_height="wrap_content" 
                android:layout_width="0dp"
                android:layout_weight="1"
                >

            </TabWidget>
            <Button
                android:layout_height="wrap_content"
                android:layout_width="46dp"
                android:background="#00F"
                android:text="+"
                >
            </Button>

        </LinearLayout>
        <FrameLayout 
            android:id="@android:id/tabcontent"
            android:layout_height="fill_parent"
             android:layout_width="fill_parent">
        </FrameLayout>

    </LinearLayout>

这让我觉得:

但我不知道我的寻呼机在哪里

我还无法确定如何对“操作栏”选项卡进行以下自定义:

  • 降低外壳,而不是所有盖
  • 标签高度
  • 选定条颜色
  • 选定字体
  • 选定/未选定文本颜色
  • 字号
  • 任何想法都将不胜感激。谢谢

    将“TabWidget”添加到“LinearLayout”或任何布局,并在需要时添加

    例如,使选项卡仅填充屏幕宽度的0.65

    <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="40dip"
                android:layout_marginBottom="6dip"
                android:baselineAligned="false"
                android:orientation="horizontal" >
    
                <TabWidget
                    android:id="@android:id/tabs"
                    android:layout_width="0dip"
                    android:layout_height="match_parent"
                    android:layout_weight="0.65"
                    android:orientation="horizontal" />
    
                <LinearLayout
                    android:layout_width="0dip"
                    android:layout_height="wrap_content"
                    android:layout_gravity="right"
                    android:layout_weight="0.35"
                    android:background="@color/transparent" />
            </LinearLayout>