Set Transparent Window in AlertDialog box

后端 未结 2 1300
刺人心
刺人心 2020-12-17 03:49

I want to set the Transparent window for the Default alertDialogbox. . . How can i able to do it ?? My Alertbox is as like this. Please refer it. .

Thanks in Advanc

2条回答
  •  执笔经年
    2020-12-17 04:31

    The link is for activity How do I create a transparent Activity on Android?

    but still you can apply the same theme for dialog box too.

    Edit

    Create a class for the dialog as below

    CustDialog.java :

    public class CustomDialog extends Dialog implements android.view.View.OnClickListener {
    
        Button button_home,button_cancel,button_resume;
        public GamePauseMenu(Context context) {
            super(context,R.style.Theme_Transparent);
    
    
        }
        public void show(int bg) {
            // TODO Auto-generated method stub
            super.show();
            setContentView(R.layout.custdialog);
            button_resume = (Button)findViewById(R.id.imageButton1);
            button_resume.setOnClickListener(this);
        }
        public void onClick(View v) {
            cancel();
    
        }
    
    
    }
    

    custdialog.xml in Layout :

    
    
    
        
        
        
    
    
    

提交回复
热议问题