setImageBitmap 分别对应着 resource,就是图片有多大然后就显示多大,如果view过小,就会截取它的一部分
setBackgroundResource ,就是将图片拉伸填充满view
如果要你的bitmap和view一直,你的view就要设定指定的大小,然后,根据大小放缩,
给你个放缩的demo把
//缩放bitmap
TARGET_WIDTH
TARGET_HEIGHT 你自己定义
public static Bitmap zoomBitmap(Bitmap target)
{
int width = target.getWidth();
int height = target.getHeight();
Matrix matrix = new Matrix();
float scaleWidth = ((float)TARGET_WIDTH)/ width;
float scaleHeight = ((float)TARGET_HEIGHT)/ height;
matrix.postScale(scaleWidth, scaleHeight);
Bitmap result = Bitmap.createBitmap(target, 0, 0, width,
height, matrix, true);
return result;
}