有人可以解释一下 RecyclerView.LayoutManager return 中的 getItemCount 方法吗?
Can someone explain what getItemCount method in RecyclerView.LayoutManager return?
文档对 getItemCount() 的描述如下:
Returns the number of items in the adapter bound to the parent RecyclerView.
Note that this number is not necessarily equal to State#getItemCount().
那么,它 return 是适配器中的所有项目还是屏幕上可见的项目?我不明白。谁能解释一下这个方法?
getItemCount() - returns The number of items currently available in adapter
此方法returns包含我们要显示的项目的集合的大小。
@Override
public int getItemCount() {
return models.size();
}
它returns适配器中当前可用的项目数。
参考:
它returns适配器中所有项目的大小不仅是可见项目的大小。简单来说,getItemCount() returns 整个适配器的大小。
getItemCount()
方法 return 列表数 items.The 此适配器正在适配的项目数。
参考代码:
ArrayList<Games> list;
public int getItemCount() {
return list.size();
}
getItemCount()
方法是 return 您正在调整的集合中的项目数,在上述情况下 list
,它只是一个 Game 对象数组。数组有一个 属性 可以让你得到它们的长度,这就是你需要 return.
getitemCount()
return 你想在 recyclerView 中显示多少项目
文档对 getItemCount() 的描述如下:
Returns the number of items in the adapter bound to the parent RecyclerView. Note that this number is not necessarily equal to State#getItemCount().
那么,它 return 是适配器中的所有项目还是屏幕上可见的项目?我不明白。谁能解释一下这个方法?
getItemCount() - returns The number of items currently available in adapter
此方法returns包含我们要显示的项目的集合的大小。
@Override public int getItemCount() { return models.size(); }
它returns适配器中当前可用的项目数。
参考:
它returns适配器中所有项目的大小不仅是可见项目的大小。简单来说,getItemCount() returns 整个适配器的大小。
getItemCount()
方法 return 列表数 items.The 此适配器正在适配的项目数。
参考代码:
ArrayList<Games> list;
public int getItemCount() {
return list.size();
}
getItemCount()
方法是 return 您正在调整的集合中的项目数,在上述情况下 list
,它只是一个 Game 对象数组。数组有一个 属性 可以让你得到它们的长度,这就是你需要 return.
getitemCount()
return 你想在 recyclerView 中显示多少项目