Note that there are some explanatory texts on larger screens.

plurals
  1. POscaled ImageView placement in RelativeLayout
    text
    copied!<p>I need to place three elements inside <code>RelativeLayout</code>:</p> <ul> <li>scaled image in <code>ImageView</code> on the right side with the top and bottom margins</li> <li><code>TextEdit</code> in the left top corner</li> <li><code>LinearLayout</code> in the rest of the space (below the title and to the left of the image)</li> </ul> <p>The problem happens when the image is scaled in <code>ImageView</code>. I want it fits the entire parent's height considering margins. After scaling uniformly to fit the parent's height I want <code>ImageView</code> wraps the image's width. But as the result there are some unfilled horizontal spaces in <code>ImageView</code>.</p> <p>The problem looks similar to one solved <a href="https://stackoverflow.com/questions/5355130/android-imageview-size-not-scaling-with-source-image/5355281#5355281">here</a>. But in my case all tests with <code>android:adjustViewBounds</code> and <code>android:scaleTypes</code> didn't work. I suppose there is a problem because of margins and RelativeLayout use.</p> <p>Here is the extract from my xml file: </p> <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;ImageView android:id="@id/albums_slideshow" android:adjustViewBounds="true" android:layout_marginTop="71.33dp" android:layout_marginBottom="88.67dp" android:scaleType="centerInside" android:layout_height="fill_parent" android:layout_width="wrap_content" android:layout_alignParentRight="true" android:src="@drawable/music_img_album_noimage"/&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="@dimen/music_module_screen_title_margin_left" android:layout_marginTop="@dimen/music_module_screen_title_margin_top" android:text="@string/music_string" style="@style/ScreenTitleFont" android:layout_alignParentLeft="true" android:layout_alignParentTop="true"/&gt; &lt;LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_alignParentLeft="true" android:layout_alignTop="@id/albums_slideshow" android:layout_toLeftOf="@id/albums_slideshow"&gt; ... &lt;/LinearLayout&gt; &lt;/RelativeLayout&gt; </code></pre> <p>Has anyone met this problem and found the answer?</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