3

I am trying a custom based listview which has a text and checkbox. I would like to disable the checkbox's clickable feature. So that the user will only be able to click on the item row rather than clicking on the checkbox.

I tried the following:

 holder.checkbox = (CheckBox) convertView.findViewById(R.id.checkBox);
 holder.checkbox.setClickable(false);

This is not disabling the clickable. How do I fix this issue?

Thanks!

TheDevMan
  • 5,914
  • 12
  • 74
  • 144

2 Answers2

6

Try this

   holder.checkbox.setEnabled(false);

for dealing with the colours of the checkbox(as asked by you in comments) see this Android: Set color of CheckBox

Community
  • 1
  • 1
nobalG
  • 4,544
  • 3
  • 34
  • 72
1

Use setEnable(true/false) instead of clickable

Vinayak
  • 6,056
  • 1
  • 32
  • 30