Pergunta

I am trying to make a list with items. These items contain a checkbox and a custom view. I want these checkboxes to have a custom image so I changed the checkbox theme. My first idea was to create a checkable linearlayout with a checkbox and a custom view. The problem occurred that the CheckBoxes took focus of the item but because I want the whole item to have a different background on click I do not want the checkboxes to take focus. That's why I changed my original idea to implementing a drawable that will represent the checked state of the item (the drawable will be replaced on click of the item). Now the problem occurs that the setChecked is not getting called. Instead of setChecked, the onClick (if I add a listener to the layout) is getting called. Shouldn't the Checkable interface provide a call to setChecked on click? Could someone elaborate?

Thanks in advance

Kind regards, Bram

Foi útil?

Solução

Calling setSelection(position) on my ListView solved my problem. Methods on the checkable layout get called now.

Kind regards, Bram

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top