0

我正在为我的标签使用 PagerSlidingTabStrip。

如何使标签适合屏幕宽度?

这是屏幕截图,我想删除多余的空间。

编辑:

布局文件

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/shop_container"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <com.astuetz.PagerSlidingTabStrip
        android:id="@+id/tabs"
        android:layout_width="match_parent"
        android:layout_height="48dip"
        android:background="@drawable/background_tabs"/>

    <android.support.v4.view.ViewPager
        android:id="@+id/shop_pager"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@+id/tabs" />

</RelativeLayout>
4

2 回答 2

4

解决了。

PagerSlidingTabStrip 本身对此有自己的设置,我忽略了这一点。

PagerSlidingTabStrip tabs = (PagerSlidingTabStrip) view.findViewById(R.id.tabs);
tabs.setShouldExpand(true);
于 2014-03-21T04:30:18.867 回答
0

正在工作中

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/shop_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:layout_alignParentLeft="true"
android:orientation="vertical">

<com.astuetz.PagerSlidingTabStrip
    android:id="@+id/tabs"
    android:layout_width="match_parent"
    android:layout_height="48dip"
    android:background="@drawable/background_tabs"
    android:orientation="horizontal"
    android:layout_weight="0"/>

<android.support.v4.view.ViewPager
    android:id="@+id/shop_pager"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_below="@+id/tabs" 
    android:layout_weight="1"/>

 </RelativeLayout>
于 2014-03-19T07:34:46.367 回答