Android仿苹果白色dialog

/**
 * 身份验证dialog
 */
public void authenticateDialog() {
    authDialog = new Dialog(this);
    authDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    Window window = authDialog.getWindow();
    window.setGravity(Gravity.CENTER);
    window.setBackgroundDrawable(new BitmapDrawable());
    authDialog.setCanceledOnTouchOutside(false);
    authDialog.show();
    View dialogView = LayoutInflater.from(this).inflate(R.layout.dialog_access_setting_page, null);
    authDialog.addContentView(dialogView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams
            .WRAP_CONTENT));
    final EditText et = (EditText) dialogView.findViewById(R.id.et_dialog_access_setting_page_password);

    dialogView.findViewById(R.id.btn_cancel_delete).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            authDialog.dismiss();
        }
    });
    dialogView.findViewById(R.id.btn_affirm_delete).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            String password = et.getText().toString().trim();
            if (TextUtils.isEmpty(password)) {
                MyApplication.Toaster("请输入密码");
            } else if (password.equals("bitlghh")) {
                authDialog.dismiss();
                Intent intent = new Intent(Layer0Activity.this, SettingActivity.class);
                startActivity(intent);
            } else {
                MyApplication.Toaster("密码错误,请重新输入");
            }
        }
    });
}

 

 

 

 

 

 

布局

 




    

        

        

            

            

            
        

        

        

            

            

            
        

    


你可能感兴趣的:(帮助,Android杂谈)