溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

EditText默認不彈出軟件鍵盤

發(fā)布時間:2020-07-02 18:12:11 來源:網絡 閱讀:299 作者:沒有水勒魚 欄目:移動開發(fā)

EditText 不彈出軟件鍵盤

方法一:

在AndroidMainfest.xml中選擇哪個activity,設置windowSoftInputMode屬性為adjustUnspecified|stateHidden
例如:
<activity android:name=".Main" android:label="@string/app_name" android:windowSoftInputMode="adjustUnspecified|stateHidden" android:configChanges="orientation|keyboardHidden"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity>
方法二:
讓EditText失去焦點,使用EditText的clearFocus方法
例如:
EditText edit=(EditText)findViewById(R.id.edit); edit.clearFocus();
方法三:
強制隱藏Android輸入法窗口
例如:
EditText edit=(EditText)findViewById(R.id.edit); InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(edit.getWindowToken(),0);
2.EditText始終不彈出軟件鍵盤
例:
EditText edit=(EditText)findViewById(R.id.edit); edit.setInputType(InputType.TYPE_NULL);


向AI問一下細節(jié)

免責聲明:本站發(fā)布的內容(圖片、視頻和文字)以原創(chuàng)、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據(jù),一經查實,將立刻刪除涉嫌侵權內容。

AI