How to create custom alert dialog in android?

前端 未结 9 1239
再見小時候
再見小時候 2020-12-09 10:36

I am developing a sample app.I am able to show alert on button click having some tittle and button .But now I want to show a pop up window having username (Label)

9条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-09 10:45

    Try this...

    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle("Reset...").setView(editText)
       .setMessage("R u sure?").setCancelable(true)
       .setPositiveButton("Yes", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int arg1) {
            //Do here whatever.....
        }
    });
    AlertDialog alert = builder.create();
    alert.show();
    }
    

提交回复
热议问题