Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get iPhone-style overscrolling in Android 2.3 (Gingerbread)?

In the stock Gingerbread release, overscrolling is indicated with an orange "flash". However, the release notes and some of the API docs seem to indicate that there is support for iPhone-style overshoot overscroll behavior. For example, see here. However, it's not clear how to make these work. Simply setting drawables with these methods does not change the behavior. Does anybody know of a way to do this?

like image 268
pents90 Avatar asked Dec 21 '10 17:12

pents90


2 Answers

I recently did a couple of blog posts about this. Have a look!

http://jasonfry.co.uk/?id=26

http://jasonfry.co.uk/?id=27

Since then I've had a thought, when you override the overScrollBy method, I'm guessing that you can half one of those parameters to get the view to not follow your finger when you overscroll, but just follow half the distance.

like image 58
jsonfry Avatar answered Oct 13 '22 10:10

jsonfry


I can't answer this from experience, but under AbsListView, there is a method called setOverScrollMode() that may be helpful. Beside that, however, I also found the OverScroller class. This seems to be more what you're looking for; the details of implementation, I can't really help with, though.

like image 44
Kevin Coppock Avatar answered Oct 13 '22 11:10

Kevin Coppock