Changing the color of over scroll in scrollview in android
Asked Answered
C

2

10

I have a small problem with my scroll view. Whenever a scroll view has over scrolled, it shows a yellow gradient (in my device, it may vary for other devices) at edges of scroll view. It can be eliminated by setting attribute as below in android 2.3 and above.

android:overScrollMode="never"

Now i want to change the default color to some other. How to achieve this.

Please help me regarding this. Any help will be appreciated.

Cerys answered 30/1, 2012 at 10:42 Comment(3)
btw, please know that the color is not always "orange". it is dependant on the device.Mure
let it be any color, is there any idea to change that color ?Cerys
According to this [post][1], there's no way to do it naturally. [1]: #5898409Isomerous
A
7

You should use the following attributes on your ListView :

<ListView
      ...
      android:overScrollHeader="@drawable/header"
      android:overScrollFooter="@drawable/footer"/>

You could also set them programatically using setOverscrollFooter(Drawable d) and setOverscrollHeader(Drawable d).

Apennines answered 30/1, 2012 at 10:52 Comment(4)
i am not asking about ListView, for Scroll View.Cerys
As u r Answer i have implement but still not got any image on overscroll in ListviewUis
Did you manage to change the color? Or did you just remove it? If you managed to change it, what did you write as drawable? See #12102608Amend
Has anyone seen how to do this for a viewpager?Pneumonic
M
2

This EdgeEffectOverride library works nicely for all scroll-type views: https://github.com/AndroidAlliance/EdgeEffectOverride

E.g.

<uk.co.androidalliance.edgeeffectoverride.EdgeEffectScrollView
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    ...
    app:edgeeffect_color="@color/red"
    />

And

EdgeEffectScrollView gridView = (EdgeEffectScrollView) root.findViewById(R.id.myscroll);
gridView.setEdgeEffectColor(Color.RED);
Mita answered 15/10, 2013 at 12:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.