PagerTabStrip - 使标签居中,或使它们合适

Bol*_*aul 1 android android-viewpager

我正在使用这个库https://github.com/astuetz/PagerSlidingTabStrip来创建一个PagerTabStrip.

我的输出 在此输入图像描述

你可以看到我的标签之后我有一些空的空间.我想让选项卡适合所有屏幕,或者至少使选项卡居中.那可能吗?

<com.astuetz.PagerSlidingTabStrip
        android:layout_gravity="center_horizontal"
        android:gravity="center_horizontal"
        android:background="@color/facebook_theme_light"
        android:id="@+id/activity_posts_tabs"
        android:layout_width="match_parent"
        android:layout_height="48dip" />

    <android.support.v4.view.ViewPager
        android:background="@color/facebook_theme_dark"
        android:id="@+id/activity_posts_pager"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/activity_posts_tabs"
        tools:context=".MainActivity" />
Run Code Online (Sandbox Code Playgroud)

mob*_*to7 6

我们正在寻找一个解决方案,并且已经在库中内置了一个,只需使用:

psts:pstsShouldExpand="true"
Run Code Online (Sandbox Code Playgroud)

并且选项卡将在布局中展开并居中.