I need to place three elements inside RelativeLayout
:
- scaled image in
ImageView
on the right side with the top and bottom margins TextEdit
in the left top cornerLinearLayout
in the rest of the space (below the title and to the left of the image)
The problem happens when the image is scaled in ImageView
. I want it fits the entire parent's height considering margins. After scaling uniformly to fit the parent's height I want ImageView
wraps the image's width. But as the result there are some unfilled horizontal spaces in ImageView
.
The problem looks similar to one solved here. But in my case all tests with android:adjustViewBounds
and android:scaleTypes
didn't work. I suppose there is a problem because of margins and RelativeLayout use.
Here is the extract from my xml file:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<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"/>
<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"/>
<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">
...
</LinearLayout>
</RelativeLayout>
Has anyone met this problem and found the answer?