If you really want the full-screen dialog to simply extend the Dialog class and add a few settings. (You can also accomplish this without expanding anything, but I thought you would want to keep everything in one place)
In your constructor you need to set a style (for your material, or it may be an empty style tag):
super(context, R.style.DialogStyle);
you also need to set the view: (Here you define where / what these two buttons are)
setContentView(R.layout.dialog_view);
Finally, you may also need to change the window layout options:
getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
I found on the devices I tested that style setting is the most important.
* EDIT *
To make this clearer, you have two options:
public class MyDialog extends Dialog { public MyDialog(Context context) { super(context, R.style.YourStyle); setContentView(R.layout.dialog_view); getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
Then, when you want to show it:
Or you can simply do this:
Dialog normalDialog = new Dialog(this, R.style.YourStyle); normalDialog.setContentView(R.layout.dialog_view); normalDialog.show();
source share