adneal
adneal

Reputation: 30814

How can I evenly space the tabs in ViewPager?

Does anyone have any tips on keeping the tabs evenly spaced in ViewPager?

    <com.jakewharton.android.viewpagerindicator.TitlePageIndicator
    android:id="@+id/indicator" android:layout_height="wrap_content"
    android:layout_width="match_parent" android:background="#404040"
    android:paddingLeft="5dp" android:paddingRight="5dp" />

tabs viewpager

Upvotes: 3

Views: 1478

Answers (1)

Jake Wharton
Jake Wharton

Reputation: 76115

As of right now there is no way to tell the widget to truncate or fade the titles. It is, however, on the todo list.

For now you can truncate the titles yourself to an acceptable length since they are provided independently. You could also be super ambitious and dive into my code and help to contribute the feature :)

I realize it's not the best solution but as large chunks of free time are few and far between lately I haven't had the time to properly implement this feature.

FYI, the fade option on the aforementioned issue will work similar to the Android market's tab indicators as described on Kirill Grouchnikov's blog.

enter image description here

Upvotes: 2

Related Questions