Yes you're correct. View's
background
scaling type is equivalent to ImageView
's ScaleType.FIT_XY
It will mess up the aspect ratio unless you're using wrap_content
and the contents do not make it stretch past background bounds.
So in this situation I usually use an ImageView
I place behind the view I need to give a properly-scaled background to. (Most likely yo're looking for CENTER_CROP
scale type)
UPD here's some code
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/instructions"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:tag="layout" >
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/photo_background"
android:scaleType="centerCrop" />
<ScrollView
android:id="@+id/scroll_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fadingEdge="none" >
<include layout="@layout/instructions_internal" />
</ScrollView>
</FrameLayout>