How to set a dialog to display in full screen?

I have a GridView that shows a lot of images, and when I click on any image, it will show the full image in a full screen dialog

Please tell me how to do it.

thank.

+86
android android-fullscreen
Jun 13 '11 at 10:41
source share
5 answers

to try

Dialog dialog=new Dialog(this,android.R.style.Theme_Black_NoTitleBar_Fullscreen) 
+165
Sep 29 '11 at 12:16
source share

based on this link , the correct answer (which I tested myself):

put this code in the constructor or in the onCreate() method of the dialog box:

 getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT); 

add a dialogue style:

 <style name="full_screen_dialog"> <item name="android:windowFrame">@null</item> <item name="android:windowIsFloating">true</item> <item name="android:windowContentOverlay">@null</item> <item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item> <item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item> </style> 

this can be achieved using a constructor, for example:

 public FullScreenDialog(Context context) { super(context, R.style.full_screen_dialog); ... 



EDIT: An alternative to all of the above would be to set the style for android.R.style.Theme and what it is.

+53
Jun 03 2018-12-12T00:
source share

EDIT Until StackOverflow allows us to update our answers, this is an answer that works for Android 3 and below. Please do not reduce it, because it does not work for you now, because it definitely works with older versions of Android.




You only need to add one line to your onCreateDialog() method:

 @Override protected Dialog onCreateDialog(int id) { //all other dialog stuff (which dialog to display) //this line is what you need: dialog.getWindow().setFlags(LayoutParams.FLAG_FULLSCREEN, LayoutParams.FLAG_FULLSCREEN); return dialog; } 
+29
Jun 13 '11 at 10:50
source share

The easiest way to find

 Dialog dialog=new Dialog(this,android.R.style.Theme_Black_NoTitleBar_Fullscreen); dialog.setContentView(R.layout.frame_help); dialog.show(); 
+28
Apr 16 '14 at 2:35
source share
 dialog = new Dialog(getActivity(),android.R.style.Theme_Translucent_NoTitleBar); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.loading_screen); Window window = dialog.getWindow(); WindowManager.LayoutParams wlp = window.getAttributes(); wlp.gravity = Gravity.CENTER; wlp.flags &= ~WindowManager.LayoutParams.FLAG_BLUR_BEHIND; window.setAttributes(wlp); dialog.getWindow().setLayout(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); dialog.show(); 

try it.

+17
Apr 07 '14 at 12:31 on
source share



All Articles