1  这里我们重点理解ImageView的属性android:scaleType,即ImageView.setScaleType(ImageView.ScaleType)。android:scaleType是控制图片如何resized/moved来匹对ImageView的size。ImageView.ScaleType / android:scaleType值的意义区别:
2
3 CENTER /center 按图片的原来size居中显示,当图片长/宽超过View的长/宽,则截取图片的居中部分显示
4
5 CENTER_CROP / centerCrop 按比例扩大图片的size居中显示,使得图片长(宽)等于或大于View的长(宽)
6
7 CENTER_INSIDE / centerInside 将图片的内容完整居中显示,通过按比例缩小或原来的size使得图片长/宽等于或小于View的长/宽
8
9 FIT_CENTER / fitCenter 把图片按比例扩大/缩小到View的宽度,居中显示
10
11 FIT_END / fitEnd 把图片按比例扩大/缩小到View的宽度,显示在View的下部分位置
12
13 FIT_START / fitStart 把图片按比例扩大/缩小到View的宽度,显示在View的上部分位置
14
15 FIT_XY / fitXY 把图片不按比例扩大/缩小到View的大小显示
16
17 MATRIX / matrix 用矩阵来绘制
  
ImageView.ScaleType CENTER Center the image in the view, but perform no scaling.ImageView.ScaleType CENTER_CROP Scale the image uniformly (maintain the image's aspect ratio) so that both dimensions (width and height) of the image will be equal to or larger than the corresponding dimension of the view (minus padding).ImageView.ScaleType CENTER_INSIDE Scale the image uniformly (maintain the image's aspect ratio) so that both dimensions (width and height) of the image will be equal to or less than the corresponding dimension of the view (minus padding).ImageView.ScaleType FIT_CENTER Scale the image using CENTER.ImageView.ScaleType FIT_END Scale the image using END.ImageView.ScaleType FIT_START Scale the image using START.ImageView.ScaleType FIT_XY Scale the image using FILL.ImageView.ScaleType MATRIX Scale using the image matrix when drawing.

更多相关文章

  1. android中实现带图片和checkbox的listview
  2. 边缘图片android布局属性详解
  3. Android缩放图片Bitmap、Drawable
  4. Android 使用 TableLayout 布局拉伸宽度
  5. Android 获取地理位置的经度和纬度
  6. Android 安装位置 - installLocation简析
  7. android 拖动图片/拖动浮动按钮

随机推荐

  1. An error has occurred. See error log f
  2. Android(安卓)图片处理之图片叠加--Bitma
  3. 启动android project时报resources.ap_ d
  4. Android(安卓)Camera子系统之进程/文件Vi
  5. fedroa16 编译android 4.0.1
  6. Android(安卓)support library支持包常用
  7. android中手势操作图片的平移、缩放、旋
  8. Android通过json向MySQL中读写数据的方法
  9. 解决ADT大量出现"Unexpected value from
  10. android中的自定义popupwindow