Question Detail

How to make full screen dialog in android?

6 years ago Views 2798 Visit Post Reply

I have tried many variants to create full-screen dialog but I couldn't. How to create customize DialogBox. I need something, like this : 

Qna full-screen dialogs android open animation

Please Help me for creating this type of Dialog Box.


Thread Reply

Anonymous

- 6 years ago

The easiest way I found

Dialog dialog=new Dialog(this,android.R.style.Theme_Black_NoTitleBar_Fullscreen);
        dialog.setContentView(R.layout.mylayout);
        dialog.show();

Anonymous

- 5 years ago

You have to set Height and Width to create full-screen dialog android material design. Below I have mentioned how to create full-screen custom dialog android

    DisplayMetrics metrics = getResources().getDisplayMetrics();
    int width = metrics.widthPixels;
    int height = metrics.heightPixels;
    dialog = new Dialog(this);
    dialog.setTitle("Select Your Way!");
    dialog.setContentView(R.layout.fullscreen_dialog);
    dialog.setCancelable(true);
    dialog.show();
    dialog.getWindow().setLayout((6 * width) / 6, WindowManager.LayoutParams.MATCH_PARENT);