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

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容