/** * 获取一块半透明背景 * @param rect 背景大小 * @param color 背景颜色 * @param aplha 背景透明度 */ public static Bitmap getGlass(Size rect, int color, int aplha){ Bitmap nb = Bitmap.createBitmap(rect.width, rect.height, Config.ARGB_8888) ; Canvas canvas = new Canvas(nb) ; Paint paint = new Paint() ; paint.setStyle(Style.FILL); paint.setColor(color); paint.setAlpha(aplha); canvas.drawRect(0, 0, rect.width, rect.height, paint); return nb ; }