I tried this but I find it not satisfying :
myCheckbox.setOnCheckedChangeListener(new OnCheckedChangeListener()
{
@Override
public void onCheckedChanged(CompoundButton checkbox, boolean checked)
{
layout_checkboxsubstitute.setBackgroundResource(checked ? R.drawable.customBackgroundStateOn : R.drawable.customBackgroundStateOff);
}
});
I created a Layout
and show it instead of Checkbox
itself. I have to change Background
manually. I'd rather stay with myCheckbox.setBackgroundResource(R.drawable.customBackground);
which is way simplier.
Does someone have a better solution ?