I've got an ImageSpan and ClickableSpan in my checkbox to display icon at the end of checkbox text and handle clicking on it. But clicking on it changes checkbox checked state, which is not needed.
How can I prevent changing checkbox state when user clicks on ClickableSpan?
Simply I need some equivalent of cancelPendingInputEvents() method for API 16+. Also I don't want to separate checkbox with checkbox and textview.
Are you using a solution similar to that outlined in https://stackoverflow.com/a/47166879/172690? If so, I have found the following
onClickimplementation to be funcional:Essentially the state is saved during the handling of the click and then posted so it can be restored. As you can imagine, the checkbox does flash and animate while pressing the clickable spannable. However, even the
cancelPendingInputEventsbranch flashes the checkbox when the link is touched, so my guess is this is the best you can do short of writing your own checkbox widget.