How to change ScrollView's position after touch?

Posted by Matt on Stack Overflow See other posts from Stack Overflow or by Matt
Published on 2010-06-17T21:00:32Z Indexed on 2010/06/17 23:33 UTC
Read the original article Hit count: 243

Filed under:

I'm trying to make a ScrollView with a list of numbers in it that the user can select from. After the user touches and scrolls, after the finger is lifted I want the scroll to "snap" to the item in the middle of the ScrollView and give me the output. My ScrollView contains a vertical linear layout with TextView objects in it. The ScrollView's vertical size is about 60sp.

I think this would involve the ScrollView.onTouch with a ACTION_UP, but I don't know how to use it. Also, is there a way to get an item's index or value based on a position in the list?

Thanks!

© Stack Overflow or respective owner

Related posts about android