老式茶几

Android Bitmap Drawable 常用摘要

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"));

  

posted on 2014-07-08 15:12  老式茶几  阅读(192)  评论(0编辑  收藏  举报

导航