Android 删除选项卡中的额外空间
我正在使用PagerSlidingAbstrip作为我的标签 如何使选项卡适合屏幕宽度 这是截图,我想删除多余的空间 编辑: 布局文件Android 删除选项卡中的额外空间,android,android-tabs,pagerslidingtabstrip,Android,Android Tabs,Pagerslidingtabstrip,我正在使用PagerSlidingAbstrip作为我的标签 如何使选项卡适合屏幕宽度 这是截图,我想删除多余的空间 编辑: 布局文件 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/shop_container" android:layout_width="match_parent" android:layout_height="
<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>
正在工作
<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>
正在工作
<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>
解决了这个问题
PagerSlidingTastrip本身对此有自己的设置,我忽略了这一点
PagerSlidingTabStrip tabs = (PagerSlidingTabStrip) view.findViewById(R.id.tabs);
tabs.setShouldExpand(true);
解决了
PagerSlidingTastrip本身对此有自己的设置,我忽略了这一点
PagerSlidingTabStrip tabs = (PagerSlidingTabStrip) view.findViewById(R.id.tabs);
tabs.setShouldExpand(true);
应该上载.xml文件应该上载.xml文件