سؤال

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?

هل كانت مفيدة؟

المحلول

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

private boolean shouldExpand = false; 

to

private boolean shouldExpand = true;

Hope this helps.!

نصائح أخرى

<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" />
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top