How to create a Custom Dialog box in android?

后端 未结 22 2806
囚心锁ツ
囚心锁ツ 2020-11-21 07:06

I want to create a custom dialog box like below

\"enter

I have tried the foll

22条回答
  •  灰色年华
    2020-11-21 07:45

    Add the below theme in values -> style.xml

    
    

    Use this theme in your onCreateDialog method like this:

    Dialog dialog = new Dialog(FlightBookActivity.this,R.style.Theme_Dialog);
    

    Define your dialog layout including title bar in the xml file and set that xml file like this:

    dialog.setContentView(R.layout.your_dialog_layout);
    

提交回复
热议问题