Android 该表位图的宽度

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

posted @ 2015-07-11 13:25  Achilles_Snow  阅读(127)  评论(0编辑  收藏  举报