Default Style Fails for ViewPagerIndicator's TabPageIndicator. Why and How to Fix?
I have the same problem, but android:theme="@style/Theme.PageIndicatorDefaults"
does not combine with my app theme.
There is another way to personalize, overwriting res/values/style.xml
:
<resources> <style name="AppTheme" parent="android:Theme.Light" > <item name="vpiTabPageIndicatorStyle">@style/CustomTabPageIndicator</item> </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">12dp</item> <item name="android:textAppearance">@style/TextAppearance.TabPageIndicator</item> <item name="android:textSize">15sp</item> <item name="android:maxLines">1</item> <item name="android:textColor">#FF555555</item> </style></resources>
I feel like a bit of a moron, but here is the exceedingly simple and obvious solution.
AndroidManifest.xml
...<activity android:name=".GalleryLists" android:theme="@style/Theme.PageIndicatorDefaults" ... ></activity>...
Yeah, all I needed to do was actually use the theme. Hopefully this will help some other poor lost soul.
A small addition to Michaels solution: in case you are using a custom theme for your Activity already, just add theese two lines to it:
<item name="vpiIconPageIndicatorStyle">@style/Widget.IconPageIndicator</item><item name="vpiTabPageIndicatorStyle">@style/Widget.TabPageIndicator</item>