现在的位置: 首页 > 综合 > 正文

AdapterView(Gallery、ListView、GridView) 调用了getCount 方法但是没有调用getView方法

2013年05月27日 ⁄ 综合 ⁄ 共 268字 ⁄ 字号 评论关闭

http://hi.baidu.com/dean_wang/blog/item/a1997b714646bd018601b043.html

通常AdapterView会在调用getCount 方法之后调用getView方法来获取根据Adapter数据生成的子View进行绘制,但是如果getCount返回0或负数,那么Adapter 的getView方法将不被调用;

另外,如果错误地调用了Adapter的notifyDataSetInvalidated方法,会导致即使在getCount函数返回大于0的情况下,getView函数仍然不被调用。

抱歉!评论已关闭.