android listView.getCount 与 listView.getChildCount 区别

  ListView.getCount()(实际上是 AdapterView.getCount()) 返回的是其 Adapter.getCount() 返回的值。

也就是“所包含的 Item 总个数”。

  ListView.getChildCount()(ViewGroup.getChildCount) 返回的是显示层面上的“所包含的子 View 个数”。

当 ListView 中的 Item 比较少无需滚动即可全部显示时,二者是等价的;当 Item 个数较多需要滚动才能浏览全部的话, getChildCount() < getCount()

其中 getChildCount() 返回的是当前可见的 Item 个数。

posted @ 2011-12-17 18:07  青香蕉  阅读(5986)  评论(0编辑  收藏  举报