0
votes

Each list item in my ListView has a button on it. When clicked, the list item grows in height and presents some extra options.

When that list item is near the bottom, those options run off screen. I'd like to make my ListView scroll a small amount to ensure the entire list item is visible.

setSelection(position) will accomplish this. However, it is not desirable as it scrolls that item to the top of the list. I just want the list item to scroll up as little as it takes to get the entire item on the screen.

Ideas?

1
I'm not sure you can do this with your expected results unless you can control absolutely the size of the device your app is running on. What fits on my Galaxy tab, won't fit on my nexus 1.jkhouw1
Yea, the scrollTo function does what I need, but like you said: every device is different. It doesn't look right on other devices :(Andrew
Actually, I have the View that is being clicked, so I can do v.getHeight() and scrollBy (which is what I meant in my previous comment) that height (the bottom half is equal in height to the top half). The problem now is, apparently scrollBy uses absolute values. If I pass -100, it will scroll by 100.Andrew

1 Answers

1
votes

Give SmoothScroll a shot, that might be what your looking for.