定制复选框
我正在尝试将图像实现为复选框。
我有一个包含 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
实现此目的的一种方法是创建一个扩展
BitmapField
的自定义Field
。 此自定义字段可以包含两个位图图像(每个州一个)。 您甚至可以考虑使用四个图像,以便您可以指示它何时也具有焦点。 例如:未选中-非焦点、未选中-焦点、选中-非焦点、选中-焦点。当您想要更改图像(即在触摸事件或轨迹球单击时)时,只需使用适当的位图调用您的自定义字段
setBitmap()
即可。One way to do this would be to create a custom
Field
that extendsBitmapField
. 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.