i've implemented "clearableedittext" relies on code droidparts. purpose have edittext
drawable
on right corner (i.e. x button) in order clear text.
i using selector button resource drawableright
. works perfect problem have button getting false pressed states it's parent (the edittext
).
to reproduce:
- run project
- enter text in first
edittext
- press anywhere inside
edittext
there's no text / drawable.
result: selector gets pressed state.
thanks help
the way achieve you're after set ontouchlistener
on entire edittext
, detect action_press
within drawable
's coordinates, replace selector accordingly. if don't want use technique have create custom view
consist of layout separates two, i.e. linearlayout
imageview
, textview
it's children.
cheers
Comments
Post a Comment