I've implemented "ClearableEditText" which mostly relies on code from DroidParts.
The purpose is to have an EditText with a Drawable on the right corner (i.e. X button) in order to clear the text.
I am using a selector for the button resource which is essentially DrawableRight.
This works perfect but the only problem I have is with the button getting false pressed states from it's parent (the EditText).
To reproduce:
EditText
EditText where there's no text / drawable.Result: selector gets PRESSED state.
Thanks for any help
The only way to achieve what you're after is to set an OnTouchListener on the entire EditText and detect ACTION_PRESS within the Drawable's coordinates, then replace the selector accordingly. If you don't want to use this technique you have to create a custom View which will consist of a layout that separates the two, i.e. LinearLayout with an ImageView and a TextView as it's children.
Cheers
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With