GridView第一个Item中的CheckBox不工作

时间:2021-12-26 15:16:09

问题:如题

解决办法:

修改后:

ViewGroup.LayoutParams params =helper.getConvertView().getLayoutParams();
params.width=LayoutParams.MATCH_PARENT;
params.height=gridView.getWidth()/ROW_NUMBER

  

修改前:

AbsListView.LayoutParams params = new AbsListView.LayoutParams(LayoutParams.MATCH_PARENT, gridView.getWidth() / ROW_NUMBER);
helper.getConvertView().setLayoutParams(params);

参考:http://www.4byte.cn/question/337904/android-gridview-checkbox-of-the-first-item-not-work-when-i-recycled-convertview.html