[#12][안드로이드] Dialog 구현 (제목, 색상, 아이콘, 배경 설정)

Dialog 구현 (제목, 색상, 아이콘, 배경 설정)

: send_class_info 클릭 시 makeDialog() 호출
 // 인증요청 버튼 클릭 이벤트 리스너
        send_class_info.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                makeDialog();
            }
        });
 
        return view;
    }
 
    private void makeDialog(){
        AlertDialog.Builder alt_bld = new AlertDialog.Builder(getContext());
        alt_bld.setMessage("입력하신 정보로 브랜드 인증 요청하시겠습니까?")
            .setCancelable(false)
            .setPositiveButton("네",
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        // 네 클릭
                    }
                })
                .setNegativeButton("아니오",
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        // 아니오 클릭. dialog 닫기.
                        dialog.cancel();
                    }
                });
        AlertDialog alert = alt_bld.create();
 
        // 대화창 클릭시 뒷 배경 어두워지는 것 막기
        //alert.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
 
        // 대화창 제목 설정
        alert.setTitle("인증 요청");
 
        // 대화창 아이콘 설정
        alert.setIcon(R.drawable.check_dialog_64);
 
        // 대화창 배경 색  설정
        alert.getWindow().setBackgroundDrawable(new ColorDrawable(Color.argb(255,62,79,92)));
 
        alert.show();
    }
cs



결과물

댓글

가장 많이 본 글