简体   繁体   中英

How to disable the dialpad soft keyboard in android?

我正在平板电脑模式下使用“电话”应用程序。我想在单击编辑文本时禁用软键盘。任何人都可以帮助我。

In your Manifest:

   <activity android:name=".MainActivity" 

            android:windowSoftInputMode="stateHidden" />

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);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM