2015-02-11 47 views

回答

2

在您的清单文件中,将此行android:windowSoftInputMode="stateHidden"添加到您的activity

+0

非常感谢!它效果很好! – epiclapser 2015-02-11 09:37:55

+0

我试过,但它说我必须等3分钟才能接受它! – epiclapser 2015-02-11 09:41:02

+0

有你去! :) – epiclapser 2015-02-11 09:45:20

1

这似乎是当你的活动开始你的TextView(因为你说的文本字段,我想你有一个TextView,但该属性存在于其他视图以及)自动接收focus。尝试查看TextView属性以查找与接收焦点的对象有关的属性。

0
 public static void hideKeyboard(Context mContext){ 
     //Hide a keypad write down on onCreate 
     ((Activity) mContext).getWindow() 
     .setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); 
} 

public static void showKeyboard(Context mContext,EditText edittext){ 
    //Show a Keyboard when you click on Edittext 
    InputMethodManager mgr = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE); 
    mgr.showSoftInput(edittext, InputMethodManager.SHOW_FORCED); 
} 
相关问题