In the ListView
from Android you got native an fading edge on the top and bottom of the view if you are getting to the end or top of the list while scrolling.
Now I was wondering if it was possible to build that same fading edge into the edges of the screen of my application? (So basically in my RelativeLayout
)
Can someone give me some guidance on this?
Here is a picture for a better understanding for what I want to achieve. If I drag an object to the left I want to fade in the blue edge and if I get closer to the edge it must be getting brighter and stronger as color.
What you need to do is put your RelativeLayout
inside a HorizontalScrollview
and add the following line to your HorizontalScrollview
:
android:overScrollMode="always"
You also can do it in code:
yourHorizontalScrollview.setOverScrollMode(View.OVER_SCROLL_ALWAYS);
Check the following link if you want some more information. http://developer.android.com/reference/android/view/View.html#setOverScrollMode(int)