How to disable the dialpad soft keyboard in android?

痴心易碎 提交于 2019-12-13 08:30:30

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!