Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change ViewPager's overscroll color

How can I change the overscroll glow effect color of a ViewPager in android? Or is there a way to change the overscroll color for the whole app via themes?

I know of setOverScrollHeader and footer, but these does "logically" of course not work for a viewpager in horizontal mode.

like image 945
Jakob Avatar asked Aug 14 '13 08:08

Jakob


1 Answers

The simplest way to do it is to override colorPrimary for your viewpager using themes.

For example :

In your fragment/activity :

<androidx.viewpager.widget.ViewPager
    android:id="@+id/viewpager"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:theme="@style/AppTheme.Viewpager" />

In your file styles.xml :

<style name="AppTheme.Viewpager" parent="AppTheme">
    <item name="colorPrimary">#FFFFFF</item>
</style>
like image 157
Jack' Avatar answered Sep 28 '22 00:09

Jack'