Android Dialog Box without buttons

前端 未结 9 2489
余生分开走
余生分开走 2021-02-19 06:52

Can i create a dialog box without negative or positive buttons. That destroys it self after specific action?

 AlertDialog.Builder dialog_detect= new AlertDialog.         


        
相关标签:
9条回答
  • 2021-02-19 07:24

    Correct code of crocboy's answer is this:

    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    
    // set title
    builder.setTitle("Your Title");
    
    // set dialog message
    builder.setMessage("Message here!").setCancelable(false);
    
    // create alert dialog
    AlertDialog alertDialog = builder.create();
    
    // show it
    alertDialog.show();
    
    // After some action
    alertDialog.dismiss(); 
    
    0 讨论(0)
  • 2021-02-19 07:28

    Implement a timer and set it to dismiss the DialogBox after a few seconds.

    0 讨论(0)
  • 2021-02-19 07:30

    You can call alertDialog .dismiss () after any action.

    0 讨论(0)
提交回复
热议问题