主要是用来显示图片
android:src=”@drawable/ceshi”:通过路径寻找具体图片
android:scaleType=”matrix”:设置图片缩放类型
android:maxHeight=”200dp”:设置图片最大高度
android:maxWidth=”200dp”:设置图片最大宽度
android:adjustViewBounds=”true”:调整View的界限(只有状态为true时候,上面两个属性才会发挥作用)
scaleType的缩放类型
1,fitStart:保持宽高缩放图片,知道较长的边与image的边长相等,缩放完成后将图片放在imagview的左上角
2,fitCentre:默认值,同上,缩放后放于中间
3,fitEnd:同上,缩放后放于右下角
4,fitXY:对图像的纵横方向进行独立缩放使图片完全适应imgeView,但是图片的宽高比可能会发生改变
5,center:保持原图的大小,显示在imgView的中心,当原图的size大于imageview的size时候,超过部分进行剪辑处理
6,centerCrop: 保持宽高比缩放图片,直到完全覆盖imageview,可能出现图片的显示不完全
7,centerInside: 保持宽高比缩放图片,直到imageview能够完全地显示图片
8,matrix:不改变原图大小,从imageView的左上角开始绘制原图,原图超过imageView的部分作裁剪处理
<?xml version=”1.0” encoding=”utf-8”?>
android:layout_height=”match_parent”
android:orientation=”vertical”
xmlns:android=”http://schemas.android.com/apk/res/android">
<ImageView<br /> android:layout_width="200dp"<br /> android:layout_height="200dp"<br /> android:src="@drawable/ceshi"<br /> android:scaleType="matrix"<br /> /><br /> <ImageView<br /> android:layout_width="wrap_content"<br /> android:layout_height="wrap_content"<br /> android:src="@drawable/ceshi"<br /> android:maxHeight="200dp"<br /> android:maxWidth="200dp"<br /> android:adjustViewBounds="true"<br /> /><br /></LinearLayout>