Dialog 스타일 사용자화, Dialog 배경 수정

        final Dialog dialog = new Dialog(this);
        View view = LayoutInflater.from(this).inflate(R.layout.xxx, null);  // 
        TextView btn = view.findViewById(R.id.finish_btn);
        btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dialog.dismiss();
            }
        });
        dialog.setContentView(view);
        dialog.getWindow().setBackgroundDrawableResource(R.drawable.bg_transparent);// , windowBackground;
        dialog.setCancelable(false);  // dialog 
        dialog.setOnKeyListener(new DialogInterface.OnKeyListener() {  // 
            @Override
            public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
                if (event.getAction() == KeyEvent.ACTION_DOWN) {  // 
                    if (System.currentTimeMillis() - FIRST_CLICK_EXIT_TIME <=                    DOUBLE_CLICK_EXIT_INTERVAL_TIME) {
                        System.exit(0);
                    } else {
                        FIRST_CLICK_EXIT_TIME = System.currentTimeMillis();
                    }
                    return true;
                }
                return false;
            }
        });
        dialog.show();

좋은 웹페이지 즐겨찾기