开发者

Is there any way to find out how many items in a list view are showing?

开发者 https://www.devze.com 2023-03-05 09:10 出处:网络
I want to do a particular action on the items of the listview that the user can see without scrolling. Is there anyway to get the amount of items shown, or is there any other way开发者_运维技巧 of app

I want to do a particular action on the items of the listview that the user can see without scrolling. Is there anyway to get the amount of items shown, or is there any other way开发者_运维技巧 of approaching this?


I dont know what exact is your requirement but to know the no list items that are currently visible

ListView.getFirstVisiblePosition();     
ListView.getLastVisiblePosition();


You can find how many items of listview below:

int count = listview.getChildCount();


Your ListView can implement onScrollListener where you can override its onScroll method. The method receives following arguments:

public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount){}

Perhaps you can start from this.

0

精彩评论

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

关注公众号