如何在黑莓中自定义列表字段?

发布于 2024-10-09 17:42:16 字数 90 浏览 0 评论 0原文

我目前正在研究列表字段。在我的列表中,每行包含标题、副标题和图像。我需要一个行列表作为输出。每行应包含两个标签文件和一个位图。

谁能告诉我一种方法吗?

I am currently working on list fields. In my list, each row contains title, subtitle and image. I need a list of rows as output. Each row should contain two labelfiels and one bitmap.

Can any tell me a way to do it?

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

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

发布评论

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

评论(1

策马西风 2024-10-16 17:42:16

您应该为 ListField 实现 ListFieldCallback。然后,您将能够在 ListFieldCallback 方法 drawListRow 中的所选位置将图像和文本添加到每一行。

要添加图像,请使用graphics.drawBitmap。 (graphics 是drawListRow 的一个参数)

drawBitmap(int x, int y, int width, int height, Bitmap bitmap, int left, int top)

x 是位图将放置的该行左侧的像素数。 Y 是距该行顶部的像素数。因此,您可以使用 y+10 使图像与行顶部间隔 10 个像素。

和graphics.drawText类似地允许您将文本放置在相对于行的左侧和顶部的位置。

如何实现ListFieldCallback

You should implement ListFieldCallback for your ListField. Then you will be able to add images and text to each row at your chosen positions within the ListFieldCallback method drawListRow.

To add an image use graphics.drawBitmap. (graphics is a parameter of drawListRow)

drawBitmap(int x, int y, int width, int height, Bitmap bitmap, int left, int top)

x is the number of pixels from the left of this row your bitmap will be placed. Y is the number of pixels from the top of this row. So you can use y+10 to get an image to have 10 pixels spacing from the top of the row.

And graphics.drawText which similarly allows you to place your text at positions relative to the left and top of the row.

How to implement ListFieldCallback

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