如何在编辑字段中的文本上绘制位图?

发布于 2024-10-04 20:59:32 字数 48 浏览 1 评论 0原文

我想在编辑字段中输入的文本上绘制位图图像。

我怎样才能做到这一点?

I would like to draw bitmap image over the text that I type in editfield.

How can I do that?

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

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

发布评论

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

评论(1

生生漫 2024-10-11 20:59:32

您需要对 EditField 进行子类化,然后重写 paint 方法。在重写中,在执行任何操作之前调用 super.paint 以便组件可以绘制文本,然后您可以使用 Paint 提供的 Graphics 对象来绘制 < code>Bitmap 覆盖 EditField 的内容 (Graphics.drawBitmap)。

You will need to subclass EditField and then override the paint method. In the override, call super.paint before you do anything so that the component can draw the text, and then you can use the Graphics object provided by paint to draw a Bitmap over the contents of the EditField (Graphics.drawBitmap).

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