当ListView有Header时,onItemClick里的position不正确

//设置header 不可选取 这样不会影响你自一定Header 里面的点击事件
 listView.addHeaderView(headerView,null,false);

listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView parent, View view, int position, long id) {
                TenProjectTaskBean.EvolveListBean item = (TenProjectTaskBean.EvolveListBean) parent.getAdapter().getItem(position);
        });

参考文章

http://blog.chengbo.net/2012/03/09/onitemclick-return-wrong-position-when-listview-has-headerview.html

https://software.intel.com/zh-cn/blogs/2014/12/15/android-listview-addheaderview-addfooterview

你可能感兴趣的:(当ListView有Header时,onItemClick里的position不正确)