tags:

views:

83

answers:

2

Hi, I have a ListView with an edit text and a button below it. When I click on a listView item the keyboard appears and push up the edit text and the button. I want the list to scroll to the selected item. Any idea? Thanks

A: 

Setup a listener on your the list item being clicked, then use View.getTop() or View.getBottom() when clicked to get it's position within the parent. You can then use ListView.scrollTo(x, y) to scroll to the list item.

h0b0
This is not working for me. If I implement your example the listView is scrolled but the selected item is not centered.
Anita
@Anita: You didn't say anything about centering... centering only takes a small modification. Simply add or reduce to the y value in proportion to to screen height.
h0b0