原文:http://blog.chengbo.net/2012/03/09/onitemclick-return-wrong-position-when-listview-has-headerview.html 当ListView实例addheaderView()或者addF ...
原文:http://blog.chengbo.net/2012/03/09/onitemclick-return-wrong-position-when-listview-has-headerview.html
当ListView实例addheaderView()或者addFooterView后,再通过setAdapter来添加适配器,此时在ListView实例变量里保存的适配器变量与我们传入的适配器变量不是同一个了。具体可参考源码:
因此,当有headerView或footerView的时候,要通过getAdapter()获取到适配器,而不是直接使用调用setAdapter是传入的入参。
原标题:当ListView有Header时,onItemClick里的position不正确
关键词:ie
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们:
admin#shaoqun.com
(#换成@)。