您的位置:首页 > 移动开发 > Android开发

android开发之ListView.getCount()与ListView.getChildCount()区别

2015-02-11 15:00 316 查看
①.

ListView.getCount()方法;实际上是AdapterView.getCount(),返回的是其Adapter.getCount()返回的值.也就是”所包含的Item总个数”.

②.

ListView.getChildCount();实际上是ViewGroup.getChildCount(),返回的是显示层面上的”所包含的子View个数”.

二者有什么不同?当ListView中的Item比较少无需滚动即可全部显示时,二者是等价的;当Item个数较多需要滚动才能浏览全部时,getChildCount()和getCount()想比较,其中getChildCount()返回的是当前可见的Item个数.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  android listview 方法 item
相关文章推荐