CheckBox and setOnItemClickListener not working in android

前端 未结 4 980
时光说笑
时光说笑 2021-01-28 02:45

I am using ListView with CheckBox. I have selected only one CheckBox but it\'s automatically selected into Multiple Rows using Scrol

4条回答
  •  鱼传尺愫
    2021-01-28 03:35

    You can get the instance of CheckBox inside onItemClick() by using setTag() and getTag(). You can setTag the CheckBox instance inside your getView() method as

    convertView.setTag(R.id.check, viewHolder.checkbox);
    

    And get the instance inside onItemClick() using,

    CheckBox checkbox = (CheckBox) v.getTag(R.id.check);
    

    If you have any further query you can check my blog post.

提交回复
热议问题