android - How to change the hint color property dynamically when its unfocsed state? -
i need change hint color property dynamically when unfocused. possible change hint color dynamically(not in focused state).
actual design
and xml
i can't change hint color property programmatically when unfocused. stuck. possible do? please me. here code -
btnsignup.setonclicklistener(new view.onclicklistener() { @override public void onclick(view view) { final string email = emailedittext.gettext().tostring(); final string pass = passedittext.gettext().tostring(); if (email.isempty()) { inputlayoutemail.sethint("email required login"); inputlayoutemail.sethinttextappearance(r.style.edittextlayout); inputlayoutemail.seterror(" "); emailedittext.sethinttextcolor(getresources().getcolor(r.color.primary_dark)); } if (pass.isempty()) { inputlayoutpassword.sethint("password required login"); passedittext.sethinttextcolor(getresources().getcolor(r.color.primary_dark)); inputlayoutpassword.sethinttextappearance(r.style.edittextlayout); inputlayoutpassword.seterror(" "); inputlayoutpassword.clearfocus(); passedittext.sethint("password required login"); passedittext.sethinttextcolor(color.red); }
use code may you.
button.setonclicklistener(new view.onclicklistener() { @override public void onclick(view view) { if (edittext1.gettext().tostring().length() == 0) { edittext1.sethinttextcolor(color.red); } if (edittext2.gettext().tostring().length() == 0) { edittext2.sethinttextcolor(color.red); } } });
Comments
Post a Comment