Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to display a dialogue to its full width for tablet of 10.1 inch
    text
    copied!<p>I want to display a dialogue whose width should fit the screen size of a tablet , can anyone let me how to do it, I tried setting the width , but did not succeed in it.</p> <p>The code is as below:</p> <pre><code> final Dialog nagDialog = new Dialog(MainActivity.this); Window window = nagDialog.getWindow(); WindowManager.LayoutParams wlp = window.getAttributes(); wlp.gravity = Gravity.BOTTOM; wlp.width= WindowManager.LayoutParams.MATCH_PARENT; window.setAttributes(wlp); getWindow().setGravity(Gravity.BOTTOM); nagDialog.setContentView(R.layout.popuplayout); nagDialog.show(); </code></pre> <p>the popuplayout.xml is as below:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/transparent" android:orientation="vertical" &gt; &lt;ImageButton android:id="@+id/img" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_marginLeft="84dp" android:layout_marginTop="59dp" android:src="@drawable/ic_launcher" /&gt; &lt;ImageButton android:id="@+id/imageButton2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignTop="@+id/img" android:layout_marginLeft="130dp" android:layout_toRightOf="@+id/img" android:src="@drawable/ic_launcher" /&gt; &lt;ImageButton android:id="@+id/imageButton2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignTop="@+id/img" android:layout_marginLeft="130dp" android:layout_toRightOf="@+id/img" android:src="@drawable/ic_launcher" /&gt; &lt;ImageButton android:id="@+id/imageButton5" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignTop="@+id/img" android:layout_marginLeft="347dp" android:layout_toRightOf="@+id/img" android:src="@drawable/ic_launcher" /&gt; &lt;ImageButton android:id="@+id/imageButton4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignTop="@+id/imageButton5" android:layout_marginLeft="163dp" android:layout_toRightOf="@+id/imageButton5" android:src="@drawable/ic_launcher" /&gt; &lt;ImageButton android:id="@+id/imageButton3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignTop="@+id/imageButton4" android:layout_marginLeft="110dp" android:layout_toRightOf="@+id/imageButton4" android:src="@drawable/ic_launcher" /&gt; &lt;/RelativeLayout&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload