Android ImageView: Fit Width
I ended up using this code:
<ImageView
android:id="@+id/background"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
android:src="@drawable/name"
/>
Make sure you set the image using src
instead of background
.
android:adjustViewBounds="true"
does the job!