Android: Disable checkboxes without graphical change?

android, checkbox, java

Solution

Gosh, so easy... `setClickable(false)` or `android:clickable="false"`. That's it.

Problem

Is it possible to do the -subject-? Right now if I set `checkboxInstance.setEnabled(false);` the checkbox gets its "disabled graphics", grayed out and more transparent. What I am trying to do is exactly the same, but I need to keep the checkbox active-looking. The reason for this is that I have an onClickListener on the parent element. That works alright but seems like when the checkbox is touched, the checkbox gets un/checked without firing off the listener of the parent (and of course I would like to fire that always). Thanks! EDIT: Basically I am looking for something like this (code in AS3, of course there is no graphics so it wouldn't really work ...but just the theory): ``` var s:Sprite = new Sprite(); var cb:Sprite = new Sprite(); //let's assume this is a checkbox s.addChild(cb); //cb is inside of the s addChild(s); //s is added to the display list s.mouseChildren = false; s.addEventListener(MouseEvent.CLICK, fireClick); //cb could have a mouse listener as well, nothing would happen as s.mouseChildren is set to false ```

Original source

Related problems