[英]How to stop soft keyboard appear by default in android
我正在主活動上編寫一個帶有兩個EditText的android應用程序。 我的問題是,一旦主要活動開始,軟鍵盤會自動出現。 我希望軟鍵盤僅在用戶單擊EditText組件時出現。 我怎么能做到這一點?
嘗試這個,
<EditText android:id="@+id/edit_text_id"
..
android:focusable="false" />
在您的活動中,在onCreate
方法中,輸入以下內容
edittext.setFocused(false);
再后來(在不同的方法,也許一個onClickListener
您的EditText)放
edittext.setFocused(true);
你也可以將下面的行放在你的manifest中,在活動部分,就在android:name
屬性的下面
android:windowSoftInputMode="stateUnchanged"
如果你想管理inpt事件,請看看這一部分:==> http://developer.android.com/guide/topics/ui/ui-events.html
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.