Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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> 
like image 413
Bob Avatar asked Apr 16 '12 11:04

Bob


People also ask

How to show custom dialog in full screen in Android?

This example demonstrate about How to make full screen custom dialog. Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main. xml.

How do I make my dialog fragment full screen?

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.

How can I make alert dialog fill 100% of screen size?

According to Android platform developer Dianne Hackborn in this discussion group post, Dialogs set their Window's top level layout width and height to WRAP_CONTENT . To make the Dialog bigger, you can set those parameters to MATCH_PARENT . Demo code: AlertDialog.

What are the three buttons that can be added to a dialog?

There are three functions for adding Buttons to Android Dialog, setPositiveButton(int textId, DialogInterface.


1 Answers

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(); 
like image 153
Renard Avatar answered Oct 20 '22 02:10

Renard