Android:ListView 中 getCount() 和 getChildCount() 的区别 [英] Android: Difference between getCount() and getChildCount() in ListView

查看:41
本文介绍了Android:ListView 中 getCount() 和 getChildCount() 的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ListView中的getCount()getChildCount()有什么区别?

推荐答案

getCount() 返回 Adapter 中的项目数(列表中的总数),getChildCount() 是一个 ViewGroup 方法,它返回子视图的数量.ListView 主动重用视图,因此如果您的列表有 1000 个项目,getCount() 将返回 1000,getChildCount() - 大约 10 个左右......

getCount() returns you a count of items in Adapter (total in list), getChildCount() is a ViewGroup method that returns you number of subviews. ListView actively reuses views so if your list has 1000 items getCount() will return 1000, getChildCount() - around 10 or so...

这篇关于Android:ListView 中 getCount() 和 getChildCount() 的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆