Is there a way to prevent the keyboard appear automatically when dialog is showing up.
here is my code for my dialog box
final Dialog dialog = new Dialog(this);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.shopping_cart_confirm_dialog);
TextView txtConfirmEmail = (TextView)dialog.findViewById(R.id.txtConfirmEmail);
...
dialog.show();
Thanks a lot.
试试这个
dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
Using InputMethodManager you should be able to hide the keyboard.
Check hideSoftInputFromWindow . It accepts a windowtoken returned by
View.getWindowToken()
InputMethodManager mgr=(InputMethodManager)getSystemService(INPUT_METHOD_SERVICE);
mgr.hideSoftInputFromWindow(dialog.getWindow().getWindowToken(), 0);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.