smoothScrollToPosition() only scrolls partway in Android ICS?

前端 未结 5 1842
闹比i
闹比i 2021-02-04 18:05

In Gingerbread, I had no issues with using smoothScrollToPosition() to scroll across dozens of items at a time. After my Nexus S was upgraded to Ice Cream Sandwich, I noticed th

5条回答
  •  囚心锁ツ
    2021-02-04 18:42

    I have an issue on ICS too.

    I have a chat message list activity, everytime after i send the message, i need to scroll the listview to bottom smoothly. So after i called notifyDataSetChanged(), i called method smoothScrollToPosition(). On other android build versions, it works well. But on ICS, it is very strange. If my listview is at bottom, i tested 3 cases. if I append one new item to the listview, it won't scroll. If i append two new items to the list view --> it will scroll well. And If i scroll the listview up a few pixes, after i append one new item, it will scroll well. After a lot of google search and test, i feel helplessness about this. At last, every time i setdata to listview, i append an empty view(1px) at the last position, though this is not a good method, but it works for me.

提交回复
热议问题