定制复选框

发布于 2024-07-21 11:27:56 字数 111 浏览 2 评论 0原文

我正在尝试将图像实现为复选框。

我有一个包含 2 列的列表,我想在右侧显示复选框图像作为第三列。单击该图像时,该图像将更改为不同的图像。

我可以通过什么方式做到这一点?

I am trying to implement image as checkbox.

I have a list with 2 columns and I want to display checbox image on right side, as a third column.On clicking that image ,the image will be changed to a different one.

In which way I can do this?

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

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

发布评论

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

评论(1

会发光的星星闪亮亮i 2024-07-28 11:27:56

实现此目的的一种方法是创建一个扩展 BitmapField 的自定义 Field。 此自定义字段可以包含两个位图图像(每个州一个)。 您甚至可以考虑使用四个图像,以便您可以指示它何时也具有焦点。 例如:未选中-非焦点、未选中-焦点、选中-非焦点、选中-焦点。

当您想要更改图像(即在触摸事件或轨迹球单击时)时,只需使用适当的位图调用您的自定义字段 setBitmap() 即可。

One way to do this would be to create a custom Field that extends BitmapField. This custom field could contain two Bitmap images (one for each state). You might even consider having four images, so that you can indicate when it has focus as well. For example: unchecked-non-focused, unchecked-focused, checked-non-focused, checked-focused.

When you want to change the image (i.e. on a touch event or trackball click) just have your custom Field call setBitmap() with the appropriate bitmap.

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