1、缩放
public Bitmap scalingBitmap(Bitmap bitmap, int newW, int newH) {
int w = bitmap.getWidth();
int h = bitmap.getHeight();
float sx = (float) newW / w;
float sy = (float) newH / h;
Matrix matrix = new Matrix();
matrix.postScale(sx, sy); // 长和宽放大缩小的比例
return Bitmap.createBitmap(bitmap, 0, 0, w, h, matrix, true);
}
2、代码修改shape颜色
GradientDrawable myGrad = (GradientDrawable) view.getBackground();
myGrad.setColor(Color.parseColor("#4bd1c9"));