Scale imageview on left to imageview on right's height

67 views Asked by At

This is what I am trying to do

I am trying to place two image views side by side with the one on the left having a height matching the one on the right. The problem is, the sizes of the image view files are much larger than how they appear on the screen. When I assign wrap content to the one on the right, it takes up all of the space, though I want it to be scaled so that there is enough room for the one on the left. I don't know if this makes sense, but here is my code.

<RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:adjustViewBounds="true"
        android:scaleType="fitXY"
        android:layout_alignParentRight="true"
        android:layout_alignParentEnd="true"
        android:src="@drawable/boombox"
        android:id="@+id/boombox"
        />

    <ImageView
        android:id="@+id/play_stop_button"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_toLeftOf="@id/boombox"
        android:scaleType="fitXY"
        android:src="@drawable/play_stop_button
        />

</RelativeLayout>
1

There are 1 answers

1
Gordak On

First try to put

android:layout_width="wrap_content"
android:layout_height="150dp"

in both imageviews to have a fixed image height