gpt4 book ai didi

android - 如何在空 Canvas 上画圆?

转载 作者:行者123 更新时间:2023-11-29 15:14:49 25 4
gpt4 key购买 nike

我想在空 Canvas 上画圆,但不知道如何做。这是我用来在我的自定义 ImageView 类中创建空 Canvas 的代码。

bmpBase = Bitmap.createBitmap(image_width, image_height, Bitmap.Config.ARGB_8888);
canvas = new Canvas(bmpBase);
Paint paint = new Paint();
paint.setColor(Color.BLUE);
canvas.drawCircle(100, 100, 30, paint);

最佳答案

试试这个,首先在您的 MainActivity 中找到您的 imageView,然后:

                drawingImageView = (ImageView)findViewById(R.id.DrawingImageView);
Paint paint = new Paint();
paint.setColor(Color.BLUE));
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeWidth(15);
bmpBase = Bitmap.createBitmap(image_width, image_height, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
canvas.drawCircle(100, 100, 30, paint);
drawingImageView.setImageBitmap(bitmap);

关于android - 如何在空 Canvas 上画圆?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25458979/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com