Android 该表位图的宽度

时间:2015-07-11 14:51:09   收藏:0   阅读:140

public Bitmap resizedBitmap(Bitmap bitmap, int screenW, int tv_count) {
int width = bitmap.getWidth();
int height = bitmap.getHeight();
int newWidth = screenW / tv_count;
int newHeight = 15;

// calculate the scale - in this case = 0.4f
float scaleWidth = ((float) newWidth) / width;
float scaleHeight = ((float) newHeight) / height;

Matrix matrix = new Matrix();
// resize the bit map
matrix.postScale(scaleWidth, scaleHeight);

Bitmap resizedBitmap = Bitmap.createBitmap(bitmap, 0, 0, width, height,
matrix, true);

return resizedBitmap;
}

原文:http://www.cnblogs.com/AchillesSnow/p/4638468.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!