问题
I am working on the Phone app in tablet mode.I want to disable the soft keypad wen we click on the edit text.Can any one please help me.. Thanks in advance.
回答1:
Use this for hide
InputMethodManager imm = (InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(edit.getWindowToken(), 0);
Use this for show
InputMethodManager imm = (InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
回答2:
In your Manifest:
<activity android:name=".MainActivity"
android:windowSoftInputMode="stateHidden" />
来源:https://stackoverflow.com/questions/13838805/how-to-disable-the-dialpad-soft-keyboard-in-android