Are you using a solution similar to that outlined in https://mcmap.net/q/293430/-how-do-i-make-a-portion-of-a-checkbox-39-s-text-clickable? If so, I have found the following onClick
implementation to be funcional:
@Override
public void onClick(View widget) {
// Prevent CheckBox state from being toggled when link is clicked
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
widget.cancelPendingInputEvents();
} else {
if (widget instanceof CheckBox) {
CheckBox checkbox = (CheckBox) widget;
boolean state = checkBox.isChecked();
checkBox.post(new Runnable() {
@Override public void run() {
checkBox.setChecked(state);
}
});
}
}
// Do action for link text...
}
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 cancelPendingInputEvents
branch 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.