如何清理或刷新 ImageView 位图画布?

发布于 2024-12-28 03:01:45 字数 361 浏览 2 评论 0原文

源代码:

//The drawing of the circle on the canvas
imageView = new ImageView(this);
bitmap = Bitmap.createBitmap(200 ,200 , Bitmap.Config.ARGB_8888);
imageView.setBackgroundDrawable(new BitmapDrawable(bitmap));
Canvas canvas = new Canvas (bitmap);
canvas.drawCircle (50 , 50 , 20 , paint );

.....

现在我想刷新或清理画布

我该怎么做?

The source code:

//The drawing of the circle on the canvas
imageView = new ImageView(this);
bitmap = Bitmap.createBitmap(200 ,200 , Bitmap.Config.ARGB_8888);
imageView.setBackgroundDrawable(new BitmapDrawable(bitmap));
Canvas canvas = new Canvas (bitmap);
canvas.drawCircle (50 , 50 , 20 , paint );

.....

Now I want to refresh or to clean the canvas

How can I do it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦与时光遇 2025-01-04 03:01:45

为什么不简单地这样做:

canvas = new Canvas(bitmap);

Why not simply do:

canvas = new Canvas(bitmap);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文