什么是ImageView的默认ScaleType?

use*_*239 66 android

什么是ImageView的默认ScaleType?如果我在普通屏幕(320x480)上放置400像素x 400像素的图像而未指定ScaleType,图像将如何缩放?

谢谢.

<?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>
Run Code Online (Sandbox Code Playgroud)

Rob*_*ond 94

FIT_CENTER:

ImageView.ScaleType FIT_CENTER

使用缩放图像CENTER.从XML,使用以下语法:android:scaleType="fitCenter".

  • 小心!!对于ImageView,默认的ScaleType值为FIT_CENTER,但对于Button,则为"fitXY" (41认同)