How to create custom alert dialog in android?

前端 未结 9 1220
再見小時候
再見小時候 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:54

    Use the below coding to display a Pop up in android.

    AlertDialog.builder builder=new AlertDilaog.Builder(this);
        builder.setMessage("PopUP Example");
        AlertDialog alert=builder.create();
        alert.setTitle("");
        alert.show();
    
        new Handler.postDelayed(new Runnable()
        {
        @override
        public void run()
        {
      //TODO
        alert.dismiss();
        }
        },1*1000);
        }
    

    Youtube link: https://www.youtube.com/watch?v=SEsVTTl6exg

提交回复
热议问题