/**
* 设置EditText有焦点时隐藏输入法
* author 000
* @param activity
* @param editText
*/
public static void setSoftInputOnFocusShow(Activity activity, EditText editText) {
if (Build.VERSION.SDK_INT <= 10) {
editText.setInputType(InputType.TYPE_NULL);
} else {
activity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
try {
Class<EditText> cls = EditText.class;
Method setSoftInputShownOnFocus;
setSoftInputShownOnFocus = cls.getMethod("setShowSoftInputOnFocus", boolean.class);
setSoftInputShownOnFocus.setAccessible(true);
setSoftInputShownOnFocus.invoke(editText, false);
} catch (Exception e) {
e.printStackTrace();
}
}
}
android 设置EditText有焦点时隐藏输入法
猜你喜欢
转载自blog.csdn.net/wyyother1/article/details/83412120
今日推荐
周排行