android - Make Dialog occupy all screen space -


this question has answer here:

i have android app should show fullscreen dialog. i've try different solution, no 1 seems work. code. layout of dialog:

<relativelayout xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:background="@color/black_transparent" >       <!--declaration of other widgets -->  </relativelayout> 

this class extends dialog:

publicmydialog(context context) {     super(context, r.style.dialogtheme); }  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     this.requestwindowfeature(window.feature_no_title);     this.setcontentview(r.layout.my_dialog);     this.setcancelable(true);     this.setcanceledontouchoutside(false);     this.getwindow().clearflags(layoutparams.flag_dim_behind);  } 

and r.style.dialogtheme declaration

<style name="dialogtheme" parent="android:theme.dialog">     <item name="android:layout_width">match_parent</item>     <item name="android:layout_height">match_parent</item>     <item name="android:windowframe">@null</item>     <item name="android:windownotitle">false</item>     <item name="android:windowfullscreen">true</item>     <item name="android:windowisfloating">true</item> </style> 

now when dialog showed doesn't fill screen. how can make dialog occupy screen?

there many options this. 1 set theme dialog i.e.

dialog dialog=new dialog(this,android.r.style.theme_black_notitlebar_fullscreen); 

and other setting layout params. (you can use in oncreatedialog() method)

 dialog.getwindow().setflags(layoutparams.flag_fullscreen, layoutparams.flag_fullscreen); 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -