user256239 user256239 - 2 months ago 11
Android Question

What's the default ScaleType of ImageView?

What's the default ScaleType of ImageView?If I put an image which is 400 pixels x 400 pixels on a normal screen (320x480) without specifying ScaleType, how will the image be scaled?

Thanks.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">

<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/big_image"
/>
</RelativeLayout>

Answer

FIT_CENTER:

ImageView.ScaleType FIT_CENTER

Scale the image using CENTER. From XML, use this syntax: android:scaleType="fitCenter".