How to set Transparent Background as a Custom Dialog Box in android

前端 未结 8 1070
梦谈多话
梦谈多话 2021-02-02 17:52

I need to make my custom dialog box as a transparent.

Sample Code :

Dialog dialog;
@Override
protected Dialog onCreateDialog(int id) 
{ 
    switch(id) 
         


        
8条回答
  •  灰色年华
    2021-02-02 18:12

    Just create a style and apply that to your dialog

        
    

    Then, create your Dialog by using this theme;

        Dialog myDialog = new Dialog(this,R.style.myDialogTheme) {
            @Override
            protected void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.about_page);
            }
        };
    

    Hope this will help you to achieve your goal.

提交回复
热议问题