Domanda

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?

È stato utile?

Soluzione

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

private boolean shouldExpand = false; 

to

private boolean shouldExpand = true;

Hope this helps.!

Altri suggerimenti

<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" />
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top