この単純なレイアウトXMLと、30X30ピクセルのgreen_square.pngファイルがあります。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ImageView
android:background="@color/red"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:adjustViewBounds="true"
android:scaleType="fitStart"
android:src="@drawable/green_square"/>
</LinearLayout>
私が達成しようとしているのは、ImageViewの余分なスペースがない状態でアスペクト比を維持しながら、親の幅を満たすように画像を拡大縮小することです。
避けたい余分なスペースを参照するために、ImageViewに赤い背景を追加しました。