How to make the list view scroll as my list item expand/collapse
I have a list view in android. And in each list item, user can expand/collapse when click on that list item. My question is how can I make the list view scroll to make the whole list item visible to user as I click the last item item which causes the last list item to expand and hence the list item increase its size (height)?
And same thing goes for when I click the list item to make the list item coll开发者_C百科apse (which makes it reduces its size)?
Thank you.
You could use:
listView1.smoothScrollToPosition(int position);
Or
listView1.smoothScrollByOffset(int offset);
精彩评论