Solved it.
PagerSlidingTabStrip itself has its own setting for this, which I've overlooked.
PagerSlidingTabStrip tabs = (PagerSlidingTabStrip) view.findViewById(R.id.tabs);
tabs.setShouldExpand(true);
문제
I'm using PagerSlidingTabStrip for my tabs.
How do I make my tabs fit to screen width?
This is the screenshot, I want to remove the extra space.
EDIT:
Layout file
<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>
해결책
Solved it.
PagerSlidingTabStrip itself has its own setting for this, which I've overlooked.
PagerSlidingTabStrip tabs = (PagerSlidingTabStrip) view.findViewById(R.id.tabs);
tabs.setShouldExpand(true);
다른 팁
Is working
<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>