How to set an ImageView to match_parent and horizontally scale accordingly? <p>I have a RelativeLayout in a section of my activity that includes a button and an ImageView. The size of the RelativeLayout is ListPreferredItemHeight and what I would like to do is have the ImageView span from top to bottom of that layout and be scaled accordingly.</p> <p>Currently, without implementing any scaling attributes, I have this image:</p> <p><img src="https://i.stack.imgur.com/ZCGxs.png" alt="enter image description here"></p> <p>I achieve this with the following xml code:</p> <pre><code>&lt;RelativeLayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1"&gt; &lt;Button android:id="@+id/newPrescription_Medication" android:gravity="center" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:layout_toLeftOf="@+id/newPrescription_AddMedication" android:layout_toStartOf="@id/newPrescription_AddMedication" android:text="@string/select_medication"/&gt; &lt;ImageView android:id="@+id/newPrescription_AddMedication" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_alignParentRight="true" android:layout_alignParentEnd="true" android:src="@drawable/add_icon"/&gt; &lt;/RelativeLayout&gt; </code></pre> <p>Now, to try and fill the space with the button, I added the following to the ImageView tag:</p> <pre><code>android:adjustViewBounds="true" android:scaleType="centerInside" </code></pre> <p><img src="https://i.stack.imgur.com/SZjzS.png" alt="enter image description here"></p> <p>How can I get the entire image to appear, while maintaining its position on the right side of the layout and filling the rest with the button?</p>