Android hide soft keyboard from compound drawable -
I have a editing text, which is a mixed drawable on the right. When I press the drawables and clear the text, I want to hide the soft keyboard. For this, I have the following code:
filterText.setOnTouchListener (new on-touchlistener) {public boolean on-touch (see V, Motion event event) {if (filterText.getCompoundDrawables ( } [2] = = null) {// cross is not being shown if there is no need to handle the return false;} if (event.getAction ()! = MotionEvent.ACTION_DOWN) {// Only type return return Answer:;} if (event. GetX ()> filterText.getMeasuredWidth () - filterText.getPaddingRight () - d.getIntrinsicWidth ()) {filterText.setText (""); Input Methanzer IRM = (Input Methodmanager) getSystemSe Rvice (reference. INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow (v .getWindowToken (), 0); return back;} and {back to true;}}});
But that does not work because the edit text seems to be in focus. I tried to filterText.clear focus but there is no way.
Thanks
Just a suggestion: Do you have EditText
?
button
on the right side
Comments
Post a Comment