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!

2 Answers 2

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

Sign up to request clarification or add additional context in comments.

6 Comments

yup,it is telling you that your checkbox is disabled
Is this the only way? Is there any other work around?
you want to disable a checkbox but don't want your users to see it that it is disabled.You will need to set some .xml file for it
Yep. I just want to disable the clickable part in the checkbox.
I tried what ever you recommended. It is not working. I can't see the changes I have done in my XML.
|
1

Use setEnable(true/false) instead of clickable

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.