android ImageView scaling to fit another View
Posted
by
Nick
on Stack Overflow
See other posts from Stack Overflow
or by Nick
Published on 2012-09-11T15:37:08Z
Indexed on
2012/09/11
15:37 UTC
Read the original article
Hit count: 382
I have a relative layout that comprises a TextView and an ImageView:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:adjustViewBounds="true"/>
</RelativeLayout>
It looks as follows:
What I want to achieve is:
It means that I want my ImageView to scale to fit the TextView by height. Can it be done in xml, without java-coding? If I could write something like
android:layout_height="match_that_TextView"
it would have solved this issue, but it's impossible I guess.
© Stack Overflow or respective owner