Android: editText's underline (drawable?) stays highlighted after focus is switched -


i unexperienced in coding, fiddling around simple android app. using edittext, text changed upon motionevent.action_up. problem is, underline stay highlighted after focus has been cleared (i tried force clearfocus().

code:

binding.edittext1fh.setontouchlistener(new view.ontouchlistener(){ private int touchcount = 0; @override     public boolean ontouch(view v, motionevent e){         if (e.getaction()==motionevent.action_up) {             // <do something>             binding.edittext1fh.clearfocus();             return true;}         else return false;     } }); 

you have remove focus on motionevent.action_down, that's when user removes finger. also, try removing focus view class @ todo

binding.edittext1fh.setontouchlistener(new view.ontouchlistener(){ private int touchcount = 0; @override public boolean ontouch(view v, motionevent e){     if (e.getaction()==motionevent.action_up) {          binding.edittext1fh.clearfocus();         //todo         return true;}     else if (e.getaction()==motionevent.action_down) {         // <do something>         binding.edittext1fh.clearfocus();         return true;} } }); 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -