Frage

I am using PagerSlidingTabStrip it's working fine in portrait mode but when I change it to landscape mode then they tabs don't cover all the screen real estate and stays left aligned.

How to make them evenly spaced?

How to fix it?

War es hilfreich?

Lösung

Just go the library class i.e. PagerSlidingTabStrip and change this line

private boolean shouldExpand = false; 

to

private boolean shouldExpand = true;

Hope this helps.!

Andere Tipps

<com.astuetz.PagerSlidingTabStrip
        android:id="@+id/tabs"
        android:layout_width="match_parent"
        android:layout_height="36dp"
        android:background="@drawable/background_tabs"
        android:fillViewport="false"
        viewpager_:pstsIndicatorHeight="3dp"
        viewpager_:pstsShouldExpand="true" /> <---just make it true

Try setting the width of your PagerSlidingTabStrip as match_parent. :)

<com.example.PagerSlidingTabStrip
    android:id="@+id/tabs"
    **android:layout_width="match_parent"**
    android:layout_height="48dip"
    android:background="@drawable/background_tabs" />
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top