Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PagerTabStrip: change Tab Width

I am wondering about how to change the tab width in Pager Tab Strip

I have browse but it is like there are no one encountering the same problem as me..

My current layout is look like this:

BigWidthTab

But i am wondering how to create the tab that has small width like this with PageTabStrip

SmallWidthTab

Most of them are using external library like ViewPagerIndicator

Is it possible to do it with PageTabStrip? Thanks Here is my current code

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

       <android.support.v4.view.PagerTabStrip
         android:id="@+id/pagerTabStrip"
         android:layout_width="match_parent"
         android:layout_height="30dp"
         android:textColor= "@color/white"
         android:layout_gravity="top" >
       </android.support.v4.view.PagerTabStrip>

     </android.support.v4.view.ViewPager>
like image 592
AlbertSamuel Avatar asked Jun 04 '14 23:06

AlbertSamuel


1 Answers

The Question is answered here: PagerTabStrip tabs alignment to left

Use this before setViewPager():

sliding_tabs.setDistributeEvenly(true);
like image 134
AlbertSamuel Avatar answered Sep 29 '22 04:09

AlbertSamuel