Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to align 2 elements where the first element fills all available space?
    text
    copied!<p>I'm trying to create the following layout, and I'm having some difficulty:</p> <p><img src="https://i.stack.imgur.com/qHL3d.png" alt="enter image description here"></p> <p>The difficulty is in getting the <code>Button</code> on the left to fill all the available space that's not taken up by the <code>ImageButton</code> on the right.</p> <p>This is the axml I'm using:</p> <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" android:gravity="center_vertical"&gt; &lt;LinearLayout android:id="@+id/layout1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal"&gt; &lt;Button android:background="@null" android:text="The Button Text" android:id="@+id/btnText" android:layout_width="fill_parent" android:layout_height="fill_parent" /&gt; &lt;/LinearLayout&gt; &lt;ImageButton android:id="@+id/imgSettings" android:layout_toRightOf="@id/layout1" android:background="@null" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:src="@drawable/settings_light" android:layout_centerVertical="true" /&gt; &lt;/RelativeLayout&gt; </code></pre> <p>and it's appearing like this:</p> <p>How can I get this to appear as outlined in the first image?</p> <p><img src="https://i.stack.imgur.com/YJxCX.png" alt="enter image description here"></p>
 

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