Android 代码绘制Bitmap

private Bitmap getRoundStrokBitmap(int fillColor, int strokColor, int width, int height, int round, int strokWidth) {    Bitmap output = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);    Canvas canvas = new Canvas(output);    RectF outerRect = new RectF(0, 0, width, height);    Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);    paint.setColor(fillColor);    paint.setStyle(Paint.Style.FILL);    canvas.drawRoundRect(outerRect, round, round, paint);    paint.setColor(strokColor);    paint.setStrokeWidth(strokWidth);    paint.setStyle(Paint.Style.STROKE);    canvas.drawRoundRect(outerRect, round, round, paint);    return output;}

int widthMeasureSpec = View.MeasureSpec.makeMeasureSpec((1 << 30) - 1, View.MeasureSpec.AT_MOST);int heightMeasureSpec = View.MeasureSpec.makeMeasureSpec((1 << 30) - 1, View.MeasureSpec.AT_MOST);dspTextView.measure(widthMeasureSpec, heightMeasureSpec);

你可能感兴趣的:(Android 代码绘制Bitmap)