时光

Strive to be an excellent developer

  :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

1,初次进入隐藏软键盘(多种方式)

getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); 

2,点击EditText获取焦点,但不弹出软键盘

public static void setDontShowSoftInputWhenFocused(EditText editText) {
   try {
	Method setShowSoftInputOnFocus = editText.getClass().getMethod("setShowSoftInputOnFocus", boolean.class);
	setShowSoftInputOnFocus.setAccessible(true);
	setShowSoftInputOnFocus.invoke(editText, false);
   } catch (Exception e) {
	e.printStackTrace();
   } 
}

引自 http://www.eoeandroid.com/forum.php?mod=viewthread&tid=318911

posted on 2015-03-16 15:36  朱东方  阅读(740)  评论(0编辑  收藏  举报