android - How to show a "Clear button" after the first character pressed and hide it when the text is ""? -
i need show clear button @ right of edit text , hide when text is"". how can that.
i need know how show , hide when text length>0 or =0, nothing more.
try code
field1.addtextchangedlistener(new textwatcher() { @override public void aftertextchanged(editable s) {} @override public void beforetextchanged(charsequence s, int start, int count, int after) { } @override public void ontextchanged(charsequence s, int start, int before, int count) { if(s.length() != 0) // set visibility } });
Comments
Post a Comment