2012-02-15 218 views
0

我想在啓動應用程序時從我的android應用程序隱藏軟鍵盤。 併爲此我使用此代碼,但沒有得到結果。請幫幫我。感謝如何隱藏軟鍵盤?

InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); 
imm.hideSoftInputFromWindow(notes.getWindowToken(), 0); 

回答

1

getWindow()setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN)。

+0

謝謝yaar我的問題就解決了,它的工作很不錯 – 2012-02-15 06:12:36

0

嘗試獲取系統鍵盤並隱藏它。

InputMethodManager in = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); 
in.hideSoftInputFromWindow(searchBar.getApplicationWindowToken(),InputMethodManager.HIDE_NOT_ALWAYS); 
1

把這一行在你的應用程序的清單文件中活動標籤..

<activity android:windowSoftInputMode="stateAlwaysHidden"> 
+0

我想這也。它也工作得很好。謝謝。 – 2012-02-15 06:13:06