开发者

android scrollbar length with different item sizes

开发者 https://www.devze.com 2023-04-04 03:47 出处:网络
I have a listview with a comments. Comments has different length开发者_运维知识库(from 1 line to 20, for example).

I have a listview with a comments. Comments has different length开发者_运维知识库(from 1 line to 20, for example). And while I'm scrolling this listview, standard scrollbar increases and decreases, depending of what the comment I'm scrolling in this moment. Why is it happening?


Maybe this is what you need. Just set it false

setSmoothScrollbarEnabled


I found this online on why this happens. Not sure why Google decided make lists height-agnostic.

If the ListView contains items with variable heights, the ListView has no way of knowing the full height of all the items it contains so the height of the thumb is calculated based on the number of items in the view and the number of items currently visible. The number of items currently visible varies, so the thumb height varies too.

On iOS the equivalent component (UITableView) requests the height of all items from the UITableViewDataSource before the view is shown so the overall thumb size can be known and kept consistent.

Max Howell, Last.fm developer
Why does the scroll bar change its length during scrolling?

0

精彩评论

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

关注公众号