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.
精彩评论