开发者

How to make the list view scroll as my list item expand/collapse

开发者 https://www.devze.com 2023-03-22 21:20 出处:网络
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 u

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);
0

精彩评论

暂无评论...
验证码 换一张
取 消