Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing the color of over scroll in scrollview in android

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.

like image 703
Yugandhar Babu Avatar asked Jan 30 '12 10:01

Yugandhar Babu


2 Answers

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).

like image 178
Ovidiu Latcu Avatar answered Sep 24 '22 01:09

Ovidiu Latcu


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);
like image 28
Alex North Avatar answered Sep 25 '22 01:09

Alex North