Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android scrollbar length with different item sizes

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?

like image 408
jumper0k Avatar asked Sep 10 '11 15:09

jumper0k


2 Answers

Maybe this is what you need. Just set it false

setSmoothScrollbarEnabled

like image 98
Jett Hsieh Avatar answered Sep 21 '22 09:09

Jett Hsieh


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?

like image 26
ADTC Avatar answered Sep 19 '22 09:09

ADTC