开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜