AlertDialog自定义界面圆角有背景问题

 

   final AlertDialog cancleDialog = new AlertDialog.Builder(this).create();
                        cancleDialog.setCancelable(false);
                        cancleDialog.setCanceledOnTouchOutside(false);
                        cancleDialog.show();
                        Window window = cancleDialog.getWindow();
                        window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));  // 有白色背景,加这句代码
                        View cancleView = LayoutInflater.from(this).inflate(R.layout.dialog_like_ios_show, null);
                        Button btn_quite = (Button) cancleView.findViewById(R.id.btn_quite);
                        Button btn_sure = (Button) cancleView.findViewById(R.id.btn_sure);
                        btn_quite.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                cancleDialog.dismiss();
                            }
                        });
                        btn_sure.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                startActivity(new Intent(MainActivity.this, LoginActivity.class));
                                cancleDialog.dismiss();
                            }
                        });

        // 解决EditText无法弹出软键盘
        dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
        window.setContentView(cancleView);

 

你可能感兴趣的:(项目中的BUG(1))