在我的应用程序中,我使用了"Listview"
. 我想要的是我必须得到count of the visible child
.
例如,如果我在我的设备中首先加载 3 行该列表视图,那么我必须在文本视图中显示"Showing 3 of 10"
,当用户滚动列表视图时,我必须根据滚动更新该文本视图。我尝试了很多,但我没有t达到了这个..
我也为此尝试过:
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。请帮我解决这个问题。