以前用recycleview没有遇到过这个问题 现在用listview添加头布局和尾布局 报错
最后发现原因 :LayoutParams惹的祸 需要给headView设置LayoutParams 需要为listView类型的
ListView.LayoutParams params = new ListView.LayoutParams(AbsListView.LayoutParams.MATCH_PARENT, AbsListView.LayoutParams.WRAP_CONTENT); headView.setLayoutParams(params);推荐一片文章也是这个问题: 点击打开链接 http://blog.csdn.net/u014657752/article/details/52343915