Note that there are some explanatory texts on larger screens.

plurals
  1. POAdjust width to half screen
    primarykey
    data
    text
    <p>I came across this link : </p> <p><a href="https://stackoverflow.com/questions/2581481/assign-width-to-half-available-screen-width-declaratively">Assign width to half available screen width declaratively</a></p> <p>How to do the same in relative layout? Here's the code: Trying linearlayout inside relative layout. But this doesn't work.</p> <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/bg" &gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="horizontal" &gt; &lt;Button android:id="@+id/button5" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="14dp" android:layout_weight="1" android:text="Button" /&gt; &lt;Button android:id="@+id/button6" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="16dp" android:layout_weight="1" android:text="Button" /&gt; &lt;Button android:id="@+id/button4" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_weight="1" android:text="UID" android:textColor="#ffe5f1f1" /&gt; &lt;EditText android:id="@+id/editText1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" android:background="#ffe5f1f1" android:hint="Enter UID" android:inputType="number" android:shadowColor="5" android:textColor="#ff009999" android:textStyle="bold" android:typeface="monospace" &gt; &lt;requestFocus /&gt; &lt;/EditText&gt; &lt;Button android:id="@+id/button7" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" android:layout_alignParentLeft="true" android:layout_marginTop="18dp" android:text="Button" /&gt; &lt;Button android:id="@+id/button8" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_below="@+id/button7" android:layout_weight="1" android:layout_marginTop="16dp" android:text="Button" /&gt; &lt;Button android:id="@+id/button9" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" android:layout_alignParentLeft="true" android:layout_below="@+id/button8" android:layout_marginTop="17dp" android:text="Button" /&gt; &lt;EditText android:id="@+id/editText2" android:layout_width="50" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_weight="1" android:background="#ffe5f1f1" android:ems="10" android:hint="Enter Name" android:inputType="number" android:inputType="textPersonName" android:textColor="#ff009999" android:textStyle="bold" android:layout_weight="1" android:typeface="monospace" /&gt; &lt;EditText android:id="@+id/editText3" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:ems="10" android:layout_weight="1" android:inputType="number" /&gt; &lt;EditText android:id="@+id/editText4" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/button7" android:layout_alignBottom="@+id/button7" android:layout_alignParentRight="true" android:ems="10" android:layout_weight="1" android:inputType="phone" /&gt; &lt;EditText android:id="@+id/editText5" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/button8" android:layout_alignBottom="@+id/button8" android:layout_alignParentRight="true" android:ems="10" android:layout_weight="1" android:inputType="textPersonName" /&gt; &lt;RadioButton android:id="@+id/radioButton2" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/button9" android:layout_alignBottom="@+id/button9" android:layout_alignLeft="@+id/editText5" android:layout_weight="1" android:text="Male" /&gt; &lt;RadioButton android:id="@+id/radioButton1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/radioButton2" android:layout_alignBottom="@+id/radioButton2" android:layout_alignParentRight="true" android:layout_weight="1" android:text="Female" /&gt; &lt;Button android:id="@+id/button10" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_below="@+id/button9" android:layout_marginTop="31dp" android:layout_weight="1" android:text="Button" /&gt; &lt;Spinner android:id="@+id/spinDept" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/button10" android:layout_alignBottom="@+id/button10" android:layout_alignLeft="@+id/radioButton2" android:layout_alignParentRight="true" android:layout_weight="1" android:background="#ff009999" /&gt; &lt;/LinearLayout&gt; &lt;/RelativeLayout&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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