码迷,mamicode.com
首页 > 移动开发 > 详细

Android 该表位图的宽度

时间:2015-07-11 14:53:58      阅读:134      评论:0      收藏:0      [点我收藏+]

标签:

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;
}

Android 该表位图的宽度

标签:

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!