2015年6月17日 星期三

android EditText 取消軟鍵盤自動彈出

Activity

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

Xml

<activity android:name="org.MainActivity" android:label="@string/app_name" android:windowSoftInputMode="stateHidden" />
 



Dialog

AlertDialog dialog = new AlertDialog.Builder(this).setView(editText).create(); dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN); dialog.show();

沒有留言:

張貼留言