gridview中的有限CheckBox

时间:2015-05-29 11:21:24

标签: android checkbox

如何在网格视图中为复选框选择设置5限制?我正在使用SparseBooleanArray ...

holder.cb.setTag(position);
holder.cb.setContentDescription(Uri.withAppendedPath(
      MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "" + imageID).toString());
holder.cb.setChecked(mSparseBooleanArray.get(position));
holder.cb.setOnCheckedChangeListener(new OnCheckedChangeListener() {
    @Override
    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
        // TODO Auto-generated method stub
        mSparseBooleanArray.put((Integer) buttonView.getTag(),  isChecked);
    }
});

0 个答案:

没有答案