Android帆布油漆无法设置深色(Android canvas paint can't set dark color)

编程入门 行业动态 更新时间:2024-10-28 10:25:00
Android帆布油漆无法设置深色(Android canvas paint can't set dark color)

我正在进行油漆应用,我将布局背景设置为白色,并将油漆颜色设置为黑色。 但是,在画布中我得到透明的黑色,我希望它是帆布颜料的深色。

我的输出是截图:

我的代码如下:

public DrawView(Context context){ super(context); setFocusable(true); setFocusableInTouchMode(true); this.setOnTouchListener(this); mPaint = new Paint(); mPaint.setAntiAlias(true); mPaint.setDither(true); mPaint.setColor(0x80808080); mPaint.setStyle(Paint.Style.STROKE); mPaint.setStrokeJoin(Paint.Join.ROUND); mPaint.setStrokeCap(Paint.Cap.ROUND); mPaint.setStrokeWidth(6); mCanvas = new Canvas(); mPath = new Path(); paths.add(mPath); }

I am working on paint application, where I have set layout background in white color and I set the paint color as black. But, in canvas I am getting transparent black color, I want it to be dark color for canvas paint.

my output is below screenshot:

and my code is below:

public DrawView(Context context){ super(context); setFocusable(true); setFocusableInTouchMode(true); this.setOnTouchListener(this); mPaint = new Paint(); mPaint.setAntiAlias(true); mPaint.setDither(true); mPaint.setColor(0x80808080); mPaint.setStyle(Paint.Style.STROKE); mPaint.setStrokeJoin(Paint.Join.ROUND); mPaint.setStrokeCap(Paint.Cap.ROUND); mPaint.setStrokeWidth(6); mCanvas = new Canvas(); mPath = new Path(); paths.add(mPath); }

最满意答案

mPaint.setColor(Color.BLACK);

代替

mPaint.setColor(0x80808080); mPaint.setColor(Color.BLACK);

instead of

mPaint.setColor(0x80808080);

更多推荐

本文发布于:2023-07-29 05:04:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1312603.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:深色   帆布   油漆   Android   canvas

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!