Ok, problem solved after having looked at the source of the CheckedTextView. I had to override the onCreateDrawableState and drawableStateChanged methods and it now works.
On 5 nov, 15:30, Marc Poppleton <[email protected]> wrote: > Hi there, > > I'm writing a little custom view which can be in two states : checked, > not checked. According to the state it is in, it's background changes. > Quite straightforward sort of behavior. > My class extends FrameLayout and implements the Checkable interface. > In my toogle method I just calls the setChecked method with a boolean > corresponding to the new state. My setChecked method simply sets a > mChecked boolean and calls the refreshDrawableState method. Pressing > the view should then toggle it back and forth between the states > check, unchecked. > The background of the FrameLayout is given a StateListDrawable in > which I've defined a drawable item for the following states : > state_pressed, state_focused, state_checked=true, state_checked=false. > When I press my custom view, the background changes all right back and > forth between the state_pressed=true and state_checked=false items. > But state_checked=true is never called. > > What am I doing wrong? > > Thank you for your help, > > Marc -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

