When I click an EditText
, the soft keyboard appears. I don't want the keyboard to appear when I clicked an EditText
, however, I want to get EditText
's forces. I want to edit it without the keyboard.
editText.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
InputMethodManager imm = (InputMethodManager)
getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(view.getWindowToken(),
InputMethodManager.HIDE_NOT_ALWAYS);
}
});
In this code, the keyboard doesn't appear when I click once. But the keyboard appears when I click many times successively.
How can I improve it? Please tell me how to do it. Thank you.
Key :
onCheckIsTextEditor()
Check whether the called view is a text editor, in which case it would make sense to automatically display a soft input window for it. This Returns true if this view is a text editor. So let's change that! Then keyboard does not appear :)Create your own class
set your xml like this
call it
check focus