【发布时间】:2013-07-16 09:16:42
【问题描述】:
在我的应用程序中,我使用了"Listview"。我想要的是我必须得到count of the visible child。
例如,如果我在我的设备中加载该列表视图的第一双鞋 3 行,那么我必须在文本视图中显示"Showing 3 of 10",并且当用户滚动列表视图我必须根据滚动更新该文本视图..我尝试了很多,但我没有做到这一点..
我也试过了:
int count=0;
for(int i = 0; i <= listView.getLastVisiblePosition(); i++)
{
if(listView.getChildAt(i)!= null)
{
count++; // saying that view that counts is the one that is not null, because sometimes you have partially visible items....
}
}
总是返回 0。请帮我解决这个问题。
【问题讨论】: