Adding a cancel button/icon on EditText with TextWatcher
I have an EditText with a TextWatcher attached to it and the onChangeText method w开发者_运维知识库orks flawlessly.
I'd like to add a mini icon/button at the very right end of the EditText, which clears the text and then disappears.
May I have some direction on how to implement this? I don't want source code, but an idea on what mechanism to use. Thank you in advance.
I would say you have it in your Layout permanently as you want it to look but you normally have the Visibility set to GONE then just set it to VISIBLE when you want it shown.
精彩评论