Home  >  Article  >  Java  >  How to block EditText soft keyboard in Android

How to block EditText soft keyboard in Android

高洛峰
高洛峰Original
2017-01-07 11:56:251636browse

The example in this article describes how to block the EditText soft keyboard in Android. Share it with everyone for your reference. The details are as follows:

The java code is as follows:

InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(myEdit.getWindowToken(), 0);
//myEdit是你的EditText对象

You can restore the display through the following method:

boolean showSoftInput(View view, int flags, ResultReceiver resultReceiver)
boolean showSoftInput(View view, int flags)
void showSoftInputFromInputMethod(IBinder token, int flags)

I hope this article will be helpful to everyone’s Android programming design.

For more related articles on how to block the EditText soft keyboard on Android, please pay attention to the PHP Chinese website!


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn