Full Screen DialogFragment in Android

AndroidAndroid Dialogfragment

Android Problem Overview


I'm trying to show an almost fullscreen DialogFragment. But I'm somehow not able to do so.

The way I am showing the Fragment is straight from the android developer documentation

FragmentManager f = ((Activity)getContext()).getFragmentManager();
FragmentTransaction ft = f.beginTransaction();
Fragment prev = f.findFragmentByTag("dialog");
if (prev != null) {
    ft.remove(prev);
}
ft.addToBackStack(null);

// Create and show the dialog.
DialogFragment newFragment = new DetailsDialogFragment();
newFragment.show(ft, "dialog");

I know naively tried to set the RelativeLayout in the fragment to fill_parent and some minWidth and minHeight.

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"  
    android:minWidth="1000px" 
    android:minHeight="600px"
    android:background="#ff0000">

I would know expect the DialogFragment to fill the majority of the screen. But I only seems to resize vertically but only until some fixed width horizontally.

I also tried to set the Window Attributes in code, as suggested here: http://groups.google.com/group/android-developers/browse_thread/thread/f0bb813f643604ec. But this didn't help either.

I am probably misunderstanding something about how Android handles Dialogs, as I am brand new to it. How can I do something like this? Are there any alternative ways to reach my goal?


Android Device:
Asus EeePad Transformer
Android 3.0.1


Update: I now managed to get it into full screen, with the following code in the fragment

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setStyle(STYLE_NO_FRAME, android.R.style.Theme_Holo_Light);
}

Unfortunately, this is not quite want I want. I definitely need a small "padding" around the dialog to show the background.

Any ideas how to accomplish that?

Android Solutions


Solution 1 - Android

To get DialogFragment on full screen

Override onStart of your DialogFragment like this:

@Override
public void onStart()
{
    super.onStart();
    Dialog dialog = getDialog();
    if (dialog != null)
    {
        int width = ViewGroup.LayoutParams.MATCH_PARENT;
        int height = ViewGroup.LayoutParams.MATCH_PARENT;
        dialog.getWindow().setLayout(width, height);
    }
}

And thanks very much to this post: The-mystery-of-androids-full-screen-dialog-fragments

Solution 2 - Android

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setStyle(DialogFragment.STYLE_NORMAL,
             android.R.style.Theme_Black_NoTitleBar_Fullscreen);
}

Solution 3 - Android

Try switching to a LinearLayout instead of RelativeLayout. I was targeting the 3.0 Honeycomb api when testing.

public class FragmentDialog extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.main);
	
	Button button = (Button) findViewById(R.id.show);
	button.setOnClickListener(new OnClickListener() {
		public void onClick(View v) {
			showDialog();
		}
	});
}

@Override
public void onSaveInstanceState(Bundle outState) {
	super.onSaveInstanceState(outState);
}

void showDialog() {
	FragmentTransaction ft = getFragmentManager().beginTransaction();
	DialogFragment newFragment = MyDialogFragment.newInstance();
	newFragment.show(ft, "dialog");
}

public static class MyDialogFragment extends DialogFragment {

	static MyDialogFragment newInstance() {
		MyDialogFragment f = new MyDialogFragment();
		return f;
	}

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
		Bundle savedInstanceState) {
		View v = inflater.inflate(R.layout.fragment_dialog, container, false);
		return v;
	}
			
}
}

and the layouts: fragment_dialog.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:minWidth="1000dp"  
    android:minHeight="1000dp"> 
 </LinearLayout> 

main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"
    android:background="#ffffff">
    <Button android:id="@+id/show"
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content"
        android:layout_weight="0"
        android:text="show">
    </Button>
</LinearLayout>

Solution 4 - Android

Make a Full screen DialogFragment by using only the style

First solution

1. Add to your style.xml:

    <style name="FullScreenDialog" parent="Theme.AppCompat.Light.Dialog">
        <item name="android:backgroundDimEnabled">false</item>
        <item name="android:windowNoTitle">true</item>
        <item name="android:padding">0dp</item>
        <item name="android:windowIsFloating">false</item>
        <item name="android:windowBackground">@android:color/transparent</item>
        <item name="android:windowCloseOnTouchOutside">false</item>
    </style>

2. Add to your DialogFragment:

@Override
public int getTheme() {
    return R.style.FullScreenDialog;
}

Alternative solution

override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)

    setStyle(DialogFragment.STYLE_NO_FRAME, R.style.FullScreenDialog)
}

Solution 5 - Android

According to this link https://stackoverflow.com/questions/18536439/dialogfragment-fullscreen-shows-padding-on-sides/25622965#25622965 this will work like a charm.

@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {

    // the content
    final RelativeLayout root = new RelativeLayout(getActivity());
    root.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));

    // creating the fullscreen dialog
    final Dialog dialog = new Dialog(getActivity());
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(root);
    dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    dialog.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);

    return dialog;
}

Solution 6 - Android

In my case I used the following approach:

    @Override
    public void onStart() {
        super.onStart();
        getDialog().getWindow().setLayout(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    }
}

Plus LinearLayout to fill all the space with content.

But there were still small gaps between left and right edges of the dialog and the screen edges on some Lollipop+ devices (e.g. Nexus 9).

It was not obvious but finally I figured out that to make it full width across all the devices and platforms window background should be specified inside styles.xml like the following:

<style name="Dialog.NoTitle" parent="Theme.AppCompat.Dialog">
    <item name="android:windowNoTitle">true</item>
    <item name="android:padding">0dp</item>
    <item name="android:windowBackground">@color/window_bg</item>
</style>

And of course this style needs to be used when we create the dialog like the following:

	public static DialogFragment createNoTitleDlg() {
	    DialogFragment frag = new Some_Dialog_Frag();
	    frag.setStyle(DialogFragment.STYLE_NO_TITLE, R.style.Dialog_NoTitle);
	    return frag;
}

Solution 7 - Android

I met the issue before when using a fullscreen dialogFragment: there is always a padding while having set fullscreen. try this code in dialogFragment's onActivityCreated() method:

public void onActivityCreated(Bundle savedInstanceState)
{	
    super.onActivityCreated(savedInstanceState);
    Window window = getDialog().getWindow();
    LayoutParams attributes = window.getAttributes();
    //must setBackgroundDrawable(TRANSPARENT) in onActivityCreated()
    window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    if (needFullScreen)
    {
        window.setLayout(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    }
}

Solution 8 - Android

As far as the Android API got updated, the suggested method to show a full screen dialog is the following:

FragmentTransaction transaction = this.mFragmentManager.beginTransaction();
// For a little polish, specify a transition animation
transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
// To make it fullscreen, use the 'content' root view as the container
// for the fragment, which is always the root view for the activity
transaction.add(android.R.id.content, this.mFragmentToShow).commit();

otherwise, if you don't want it to be shown fullscreen you can do this way:

this.mFragmentToShow.show(this.mFragmentManager, LOGTAG);

Hope it helps.

EDIT

Be aware that the solution I gave works but has got a weakness that sometimes could be troublesome. Adding the DialogFragment to the android.R.id.content container won't allow you to handle the DialogFragment#setCancelable() feature correctly and could lead to unexpected behaviors when adding the DialogFragment itself to the back stack as well.

So I'd suggested you to simple change the style of your DialogFragment in the onCreate method as follow:

@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setStyle(DialogFragment.STYLE_NORMAL, android.R.style.Theme_Translucent_NoTitleBar);
}

Hope it helps.

Solution 9 - Android

And the kotlin version!

override fun onStart() {
    super.onStart()
    dialog?.let {
        val width = ViewGroup.LayoutParams.MATCH_PARENT
        val height = ViewGroup.LayoutParams.MATCH_PARENT
        it.window?.setLayout(width, height)
    }
}

Solution 10 - Android

Try to use setStyle() in onCreate and override onCreateDialog make dialog without title

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);    
    setStyle(DialogFragment.STYLE_NORMAL, android.R.style.Theme);        
}

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Dialog dialog = super.onCreateDialog(savedInstanceState);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);        
    return dialog;
}

or just override onCreate() and setStyle fellow the code.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);    
    setStyle(DialogFragment.STYLE_NO_TITLE, android.R.style.Theme);        
}

Solution 11 - Android

It can indeed depends on how the layout is defined. But to ensure that the dialog gets the required size, the best solution is to provide the LayoutParams once the dialog is shown (and not on creation). On a DialogFragment the dialog is shown on the onStart method, so a valid method to get full width is:

@Override public void onStart() {
    super.onStart();
    Dialog d = getDialog();
    if (d!=null){
        d.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    }
}

To also provide a theme, or style, like a NO_TITLE style, the best location is on the onCreate method:

@Override public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setStyle(STYLE_NO_TITLE, android.R.style.Theme_Holo_Light_Dialog);
}

Solution 12 - Android

Note : Even one can find right answer here. But I want clarify a confusion.

Use below code for android.app.DialogFragment
@Override
public void onStart()
{
    super.onStart();
    Dialog dialog = getDialog();
    if (dialog != null)
    {
        int width = ViewGroup.LayoutParams.MATCH_PARENT;
        int height = ViewGroup.LayoutParams.MATCH_PARENT;
        dialog.getWindow().setLayout(width, height);
    }
}
Use below code for android.support.v4.app.DialogFragment
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setStyle(DialogFragment.STYLE_NORMAL, android.R.style.Theme_Black_NoTitleBar_Fullscreen);
}

Solution 13 - Android

The easiest way to do achieve this is :

Add the following theme to your styles.xml

<style name="DialogTheme" parent="AppTheme">
    <item name="android:windowNoTitle">true</item>
    <item name="android:windowFullscreen">false</item>
    <item name="android:windowIsFloating">false</item>
</style>

and in your class extending DialogFragment, override

@Override
public int getTheme() {
    return R.style.DialogTheme;
}

This will work on Android OS 11(R) as well.

https://anubhav-arora.medium.com/android-full-screen-dialogfragment-1410dbd96d37

Solution 14 - Android

This is the solution how I figured out this issue:

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Dialog dialog = super.onCreateDialog(savedInstanceState);    
    dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);   
    
    return dialog;
}

@Override
public void onStart() {
    super.onStart();
    Dialog dialog = getDialog();
    if (dialog != null) {
            dialog.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
            dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    }
}

Solution 15 - Android

Create below theme in your style.xml:

<style name="DialogTheme" parent="Theme.AppCompat.Light.DarkActionBar">
   <item name="android:paddingRight">0dp</item>
   <item name="android:paddingLeft">0dp</item>
   <item name="android:layout_width">match_parent</item>
   <item name="android:windowNoTitle">true</item>
</style>

then set the style in DialogFragment

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setStyle(DialogFragment.STYLE_NO_TITLE, R.style.DialogTheme);
}

Solution 16 - Android

Chirag Nagariya is right except the '_Fullscreen' addition. it can be solved using any base style which not derived from Dialog style. 'android.R.style.Theme_Black_NoTitleBar' can be used as well.

Solution 17 - Android

The following way will work even if you are working on a relative layout. Follow the following steps:

  1. Go to theme editor ( Available under Tools-> Android -> Theme Editor)

  2. Select show all themes. Select the one with AppCompat.Dialog

  3. Choose the option android window background if you want it to be of any specific colored background or a transparent one.

  4. Select the color and hit OK.Select a name of the new theme.

  5. Go to styles.xml and then under the theme just added, add these two attributes:

    <item name="android:windowNoTitle">true</item>
    <item name="android:windowIsFloating">false</item>
    

My theme setting for the dialog is as under:

<style name="DialogTheme" parent="Theme.AppCompat.Dialog" >
    <item name="android:layout_width">match_parent</item>
    <item name="android:layout_height">match_parent</item>
    <item name="android:windowBackground">@android:color/transparent</item>
    <item name="android:windowNoTitle">true</item>
    <item name="android:windowIsFloating">false</item>

Make sure that the theme has a parent as Theme.AppCompat.Dialog Another way would be just make a new style in styles.xml and change it as per the code above.

  1. Go to your Dialog Fragment class and in the onCreate() method, set the style of your Dialog as:

    @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setStyle(DialogFragment.STYLE_NORMAL,R.style.DialogTheme); }

Solution 18 - Android

In case anyone else comes across this, I had a similar experience to this but it turns out that the issue was that I had forgotten to return the inflated view from onCreateView (instead returning the default super.onCreateView). I simply returned the correct inflated view and that solved the problem.

Solution 19 - Android

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Dialog dialog = new Dialog(getActivity(), android.R.style.Theme_Holo_Light);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);

    return dialog;
}

This solution applies a full screen theme on the dialog, which is similar to Chirag's setStyle in onCreate. A disadvantage is that savedInstanceState is not used.

Solution 20 - Android

Try this for common fragment dialog for multiple uses. Hope this will help you bettor

public class DialogFragment extends DialogFragment {

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.fragment_visit_history_main, container, false);

        getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE);
        getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
        initializeUI(rootView);
        return rootView;
    }

    @Override
    public void onStart() {
        super.onStart();
        Dialog dialog = getDialog();
        if (dialog != null) {
            int width = ViewGroup.LayoutParams.MATCH_PARENT;
            int height = ViewGroup.LayoutParams.MATCH_PARENT;
            dialog.getWindow().setLayout(width, height);
        }
    }
    private void initializeUI(View rootView) {
    //getChildFragmentManager().beginTransaction().replace(R.id.fv_container,FragmentVisitHistory.getInstance(), AppConstant.FRAGMENT_VISIT_HISTORY).commit();
    }
}

Solution 21 - Android

This is what you need to set to fragment:

/* theme is optional, I am using leanback... */
setStyle(STYLE_NORMAL, R.style.AppTheme_Leanback);

In your case:

DialogFragment newFragment = new DetailsDialogFragment();
newFragment.setStyle(STYLE_NORMAL, R.style.AppTheme_Leanback);
newFragment.show(ft, "dialog");

And why? Because DialogFragment (when not told explicitly), will use its inner styles that will wrap your custom layout in it (no fullscreen, etc.).

And layout? No hacky way needed, this is working just fine:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="match_parent"
            android:layout_height="match_parent">
    ...
</RelativeLayout>

Enjoy

Solution 22 - Android

I am very late for answering this question still i want to share this answer so that in future anyone can use this.

I have used this code in my project it works in lower version as well as higher version.

Just use this theme inside onCreateDialog() like this :

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {

    View view = getActivity().getLayoutInflater().inflate(R.layout.dialog_pump_details, null);
    
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), android.R.style.Theme_Black_NoTitleBar_Fullscreen);
    return builder.create();
}

android.R.style.Theme_Black_NoTitleBar_Fullscreen - Here is the source code for this theme you can see only this theme is enough to make DialogFragment appear in full screen.

<!-- Variant of {@link #Theme_Black} that has no title bar and
     no status bar.  This theme
     sets {@link android.R.attr#windowFullscreen} to true.  -->
<style name="Theme.Black.NoTitleBar.Fullscreen">
    <item name="windowFullscreen">true</item>
    <item name="windowContentOverlay">@null</item>
</style>

Please let me know if anyone face any issue. Hope this is helpful. Thanks :)

Solution 23 - Android

Add this below lines in style of the full screen dialog.

<item name="android:windowNoTitle">true</item>
    <item name="android:windowFullscreen">true</item>
    <item name="android:windowIsFloating">false</item>

Solution 24 - Android

window.setLayout isn't enough for older devices.

Here is what I do:

try {
    ViewGroup parent = (ViewGroup) view;
    do {
        parent = (ViewGroup) parent.getParent();
        if (parent == null)
            break;
    
        parent.getLayoutParams().height = ViewGroup.LayoutParams.MATCH_PARENT;
        parent.getLayoutParams().width = ViewGroup.LayoutParams.MATCH_PARENT;
        parent.requestLayout();
    } while (true);
} catch (Exception e){}

Solution 25 - Android

This below answer works for me in fragment dialog.  


  Dialog dialog = getDialog();
        if (dialog != null)
        {
            int width = ViewGroup.LayoutParams.MATCH_PARENT;
            int height = ViewGroup.LayoutParams.MATCH_PARENT;
            dialog.getWindow().setLayout(width, height);
        }

Solution 26 - Android

A solution by using the new ConstraintLayout is wrapping the ConstraintLayout in a LinearLayout with minHeight and minWidth fixed. Without the wrapping, ConstraintLayout is not getting the right size for the Dialog.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:minWidth="1000dp"
    android:minHeight="1000dp"
    android:orientation="vertical">

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/background_color"
        android:orientation="vertical">
        <!-- some constrained views -->
    </androidx.constraintlayout.widget.ConstraintLayout>
    
</LinearLayout>

Solution 27 - Android

Worked for me in Kotlin,

 override fun onActivityCreated(savedInstanceState: Bundle?) {
    super.onActivityCreated(savedInstanceState)

    dialog?.window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)

}

Solution 28 - Android

the following solution worked for me other solution gave me some space in the sides i.e not full screen

You need to make changes in onStart and onCreate method

@Override
public void onStart() {
    super.onStart();
    Dialog dialog = getDialog();
    if (dialog != null)
    {
        int width = ViewGroup.LayoutParams.MATCH_PARENT;
        int height = ViewGroup.LayoutParams.MATCH_PARENT;
        dialog.getWindow().setLayout(width, height);
    }
}


 public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
    final Dialog dialog = new Dialog(requireContext());
    dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
 }


   

Solution 29 - Android

No more style that need more complex code.. with status bar..

public static void ShowFullScreenDialog(Context context, View contentView, string header)
        {

            using (Android.Support.V7.App.AlertDialog.Builder builder = new Android.Support.V7.App.AlertDialog.Builder(context, Android.Resource.Style.ThemeBlackNoTitleBarFullScreen))
            {
                var view = UIHelper.InflaterView(context, Resource.Layout.dialog_full_screen);
                builder.SetView(view);
                Dialog dialog = builder.Create();
                dialog.Window.SetBackgroundDrawableResource(ThemeHelper.GetMainActivityThemeDrawable());
                dialog.Window.SetLayout(context.Resources.DisplayMetrics.WidthPixels, context.Resources.DisplayMetrics.HeightPixels);
                dialog.Window.DecorView.SystemUiVisibility = StatusBarVisibility.Visible;
                
                //fullLinear
                var headtxt = view.FindViewById<TextView>(Resource.Id.headertxt);
                headtxt.SetTextColor(Color.White);
                headtxt.Text = header;
                var fullLinear = view.FindViewById<LinearLayout>(Resource.Id.fullLinear);
                var closeBttn = view.FindViewById<ImageButton>(Resource.Id.closeBttn);
                closeBttn.ImageTintList = ColorHelper.ConvertColorToStateList(Color.White);
                closeBttn.Click += delegate
                {
                    dialog.Hide();
                };
                if (contentView.Parent != null)
                    ((ViewGroup)contentView.Parent).RemoveView(contentView); // <- fix
                fullLinear.AddView(contentView);
                
                dialog.Show();
            }
            
        }

Important

dialog.Window.SetLayout(context.Resources.DisplayMetrics.WidthPixels, context.Resources.DisplayMetrics.HeightPixels);

Solution 30 - Android

class NameDialog : DialogFragment(){
lateinit  var mDataBinding:NameYourLayoutBinding

    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View {
         super.onCreateView(inflater, container, savedInstanceState)
        mDataBinding=DataBindingUtil.inflate(
            LayoutInflater.from(getContext()),
            R.layout.YOUR.LAYOUT.NAME,
            null,
            false
        )
        dialog?.let {
            it.window?.requestFeature(Window.FEATURE_NO_TITLE)
            it.window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
        }
        return mDataBinding.root
    }



    override fun onStart() {
        super.onStart()
        dialog?:return
            val width = ViewGroup.LayoutParams.MATCH_PARENT
            val height = ViewGroup.LayoutParams.MATCH_PARENT
            dialog?.window?.setLayout(width, height)

    }

}

Solution 31 - Android

This was a productive find to run a full screen dialog box:

AlertDialog.Builder(activity, R.style.Theme_AppName_PopupOverlay)

with the corresponding theme:

<!--night\theme-->
<style name="Theme.AppName.PopupOverlay" parent="ThemeOverlay.AppCompat.Light">
    <!--text-->
    <item name="colorPrimary">@color/white</item>
    <!--title-->
    <item name="android:textColor">@color/white</item>
    <!--window color-->
    <item name="android:backgroundTint">@color/grey_dark</item>
</style>

The Alert Dialog Builder also needs the reference to the PopupOverlay for the day theme. So I just have:

<style name="Theme.AppName.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionEricView Question on Stackoverflow
Solution 1 - AndroidDavidView Answer on Stackoverflow
Solution 2 - AndroidChirag NagariyaView Answer on Stackoverflow
Solution 3 - Androidbradley4View Answer on Stackoverflow
Solution 4 - AndroidvovahostView Answer on Stackoverflow
Solution 5 - AndroidAyman MahgoubView Answer on Stackoverflow
Solution 6 - AndroidgoRGonView Answer on Stackoverflow
Solution 7 - AndroidruidgeView Answer on Stackoverflow
Solution 8 - Androidandrea.rinaldiView Answer on Stackoverflow
Solution 9 - AndroidBoldijar PaulView Answer on Stackoverflow
Solution 10 - AndroidJay ParkerView Answer on Stackoverflow
Solution 11 - AndroidcoderazziView Answer on Stackoverflow
Solution 12 - AndroidKhemraj SharmaView Answer on Stackoverflow
Solution 13 - AndroidAnubhavView Answer on Stackoverflow
Solution 14 - AndroidsavepopulationView Answer on Stackoverflow
Solution 15 - AndroidZahra.HYView Answer on Stackoverflow
Solution 16 - AndroidShoham Ben-HarView Answer on Stackoverflow
Solution 17 - AndroidSaumya MehtaView Answer on Stackoverflow
Solution 18 - Androiduser1205577View Answer on Stackoverflow
Solution 19 - AndroidAlpha HuangView Answer on Stackoverflow
Solution 20 - AndroidDashrath RathodView Answer on Stackoverflow
Solution 21 - AndroidarenaqView Answer on Stackoverflow
Solution 22 - AndroidBiswajitView Answer on Stackoverflow
Solution 23 - AndroidMEGHA DOBARIYAView Answer on Stackoverflow
Solution 24 - AndroidpalindromView Answer on Stackoverflow
Solution 25 - AndroidMEGHA DOBARIYAView Answer on Stackoverflow
Solution 26 - AndroidNicola GallazziView Answer on Stackoverflow
Solution 27 - AndroidAzizView Answer on Stackoverflow
Solution 28 - Androidnikhil123View Answer on Stackoverflow
Solution 29 - AndroidMinute VView Answer on Stackoverflow
Solution 30 - AndroideagerprinceView Answer on Stackoverflow
Solution 31 - AndroidGotDotsView Answer on Stackoverflow