解决 AlertDialog 中 EditText 自动弹出

来源:互联网 发布:成男脸型数据 编辑:程序博客网 时间:2024/06/05 00:25

解决 AlertDialog 中 EditText 自动弹出

解决 AlertDialog 中 EditText 自动弹出 影响弹出动画
本人亲测通过!!!!!!

主要部分

 Window win = dialog.getWindow();        win.setWindowAnimations(R.style.dialogWindowAnim);        win.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);        dialog.show();

public class ChooseAlertDialog {    private Context context;    private CharSequence[] charSequences;    private CallBackDialogInterface callback;    private  AlertDialog.Builder builder;    private String title;    public ChooseAlertDialog(Context context, CallBackDialogInterface callback, CharSequence[] charSequences,String title) {        this.context = context;        this.charSequences = charSequences;        this.callback = callback;        this.title = title;        builder = new AlertDialog.Builder(context);    }    public void show(){        AlertDialog dialog = builder.setTitle(title)                //.setIcon(R.drawable.ic_launcher)                .setItems(charSequences, new DialogInterface.OnClickListener() {                    @Override                    public void onClick(DialogInterface dialog, int which) {                        dialog.dismiss();                        Log.i("TAG", "选择:"+charSequences[which]);                        callback.call(charSequences[which]+"");                    }                }).create();        Window win = dialog.getWindow();        win.setWindowAnimations(R.style.dialogWindowAnim);        win.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);        dialog.show();    }}
public interface CallBackDialogInterface {    void call(String str);}
阅读全文
0 0
原创粉丝点击