Custom Dialog in full screen?
Is there any way to make my Dialog view full screen, i.e dialog occupy the entire screen (like an Activity). I tried using the LayoutParams and styles like
<item name="android:windowFullscreen">true</item>
but nothing seems to be working.
I found a way of getting rid of the Title bar, but couldn't find a way to put a dialog in full screen. So can any one suggest me a way to do it.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="MyTheme" parent="@android:style/Theme.Dialog">
<item name="android:windowFullscreen">true</item>
<item name="android:windowFrame">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowBackground">@color/dialog_background</item>
</style>
</resources>
Give its constructor a non-dialog theme, such as android.R.style.Theme or android.R.style.Theme_Light.
Code by @Bob.
Dialog dialog = new Dialog(context, android.R.style.Theme_Light);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.MyCustomDialogLayout);
dialog.show();
Following code works in my case :
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.mydialog2);
dialog.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
Try this
dialog = new Dialog(context,android.R.style.Theme_Translucent_NoTitleBar_Fullscreen);