JakeWharton / ViewPagerIndicator

Paging indicator widgets compatible with the ViewPager from the Android Support Library and ActionBarSherlock.
http://viewpagerindicator.com
10.14k stars 4.01k forks source link

Tab Page Indicator completely unstyled #275

Open jmrboosties opened 10 years ago

jmrboosties commented 10 years ago

Using the TabPageIndicator class as shown in the example from the default implementation:

<com.viewpagerindicator.TabPageIndicator android:id="@+id/fp_indicator" android:layout_width="match_parent" android:layout_height="wrap_content"/>

Results in unstyled tabs which look like regular TextViews:

http://i.stack.imgur.com/Hg5C4.png

(the text Page 1 and Page 2 are what are supposed to be tabs)

Using Android Studio (not gradle). I checked and the entire ViewPagerIndicator module is being imported and used as a dependency, and I even flagged the res folder of ViewPagerIndicator as a resource folder under Source (by default it is unflagged, didn't work then either).

Any thoughts?

dregre commented 10 years ago

Exact same issue, no success. Were you able to solve it, @jmrboosties ?

jmrboosties commented 10 years ago

Yea, I was able to solve it. I don't know if this is what was supposed to be done, but I created a custom style:

<style name="CustomTabPageIndicator" >
    <item name="android:gravity">center</item>
    <item name="android:background">@drawable/vpi__tab_indicator</item>
    <item name="android:paddingTop">12dp</item>
    <item name="android:paddingBottom">14dp</item>
    <item name="android:textAppearance">@style/TextAppearance.TabPageIndicator</item>
    <item name="android:textSize">12dp</item>
    <item name="android:maxLines">1</item>
    <item name="android:textColor">#FF555555</item>
</style>

And added it to my app's Theme like this:

<item name="vpiTabPageIndicatorStyle">@style/CustomTabPageIndicator</item>

That did the trick.