Android ListView set Number of items to show

不羁的心 提交于 2019-12-01 21:54:41

问题


How can i set the number of items to show in a list without to scroll?

Example: I have a list with 10 items. I want that only 3 items appears and that I have to scroll to see the rest of the items.


回答1:


I think the amount of Items shown in the Listview depends on the size that is available for the list. I would try a layout that limits the size of the list. It could be possible that such a detailed layout is not possible very easily, a different screen size could show more items etc.




回答2:


just do:

list.remove(3);
list.remove(4);
...
list.remove(9);

in the constructor of the listview adapter.



来源:https://stackoverflow.com/questions/2378559/android-listview-set-number-of-items-to-show

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!