user2645280
user2645280

Reputation: 21

Using viewpagerindicator with ActionBarcompat

I understand that viewpagerindicator is compatible with ActionBarSherlock and no mention is made of its compatibility with ActionBarcompat on their website. However, I was wondering if it is possible to use viewpagerindicator with ActionBarcompat (android.v7.support).

With ActionBarCompat, you have to apply Theme.AppCompat, however with this theme, the theme for Tabs using TabPageIndicator of viewpagerindicator does NOT work.

Upvotes: 2

Views: 978

Answers (1)

Marcin Palka
Marcin Palka

Reputation: 21

ViewPagerIndicator does not depend on ActionBarSherlock. It only depends on the android support library.
When it comes to styling you need to override vpiTabPageIndicatorStyle in your stylesheet. The same you have to do with ActionBarSherlock. I assume you are aware you need to include the AppCompat as a library module in your project to make the styles and other resources work. It's not enough to use the jar.

Please refer to the this thread for more details:

<style name="Theme.Mniamo.Light.DarkActionBar" parent="@style/Theme.Sherlock.Light.DarkActionBar.ForceOverflow">
    <item name="vpiTabPageIndicatorStyle">@style/MniamoTabPageIndicatorLightDarkActionBar</item>

...

<style name="MniamoTabPageIndicatorLightDarkActionBar">
    <item name="android:gravity">center_vertical|center_horizontal</item>
    <item name="android:background">@drawable/ng_tab_indicator</item>
    <item name="android:paddingLeft">4dip</item>
    <item name="android:paddingRight">4dip</item>
    <item name="android:paddingTop">8dp</item>
    <item name="android:paddingBottom">12dp</item>
    <item name="android:textAppearance">@style/MniamoTextAppearance.TabPageIndicator.Light</item>
    <item name="android:textSize">14dp</item>
    <item name="android:lines">1</item>
    <item name="android:scaleType">centerInside</item>
</style>

Of course you need to replace ABS styles with respecitive styles from the AppCompat lib.

Upvotes: 1

Related Questions