how to add shadow effect in alert dialog box in android

后端 未结 3 558
轻奢々
轻奢々 2021-01-03 15:53

i want to add shadow effect in alert dialog box . i want this type of shadow effect in my dialog box here i post 3 files first is style.xml second is theme.java or third fil

3条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-03 16:48

    I have created custom shadow file (shadow.xml) below

    
    
        
             
                
                
                
            
        
        
             
                
                
                
            
        
    
    

    In the next step you should change your dialog theme as what is in the following:

    
    

    Now you are done, just create a new instance of the Dialog class and apply this theme to it (in Dialog constructor):

    Dialog dialog = new Dialog(this, R.style.dialog_theme);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.mdialog);
    dialog.show();
    

提交回复
热议问题