1个回答
2016-03-29
展开全部
直接调用这方法,会返回一张和屏幕大小相同的图片
public static Bitmap FitTheScreenSizeImage(Bitmap m,int ScreenWidth, int ScreenHeight)
{
float width = (float)ScreenWidth/m.getWidth();
float height = (float)ScreenHeight/m.getHeight();
Matrix matrix = new Matrix();
matrix.postScale(width,height);
return Bitmap.createBitmap(m, 0, 0, m.getWidth(), m.getHeight(), matrix, true);
}
public static Bitmap FitTheScreenSizeImage(Bitmap m,int ScreenWidth, int ScreenHeight)
{
float width = (float)ScreenWidth/m.getWidth();
float height = (float)ScreenHeight/m.getHeight();
Matrix matrix = new Matrix();
matrix.postScale(width,height);
return Bitmap.createBitmap(m, 0, 0, m.getWidth(), m.getHeight(), matrix, true);
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询