J2ME Midp Form - ImageItem - 对齐图像和文本

发布于 2024-11-15 07:55:24 字数 638 浏览 10 评论 0原文

我正在以 midp 形式创建 ImageItem,但是,当文本换行到下一行时,图像会移至顶部,并且文本会显示在新行中。有什么想法如何避免这种情况吗?

示例:

*Image*
this is a a test, hello
world, this is a test

我需要它是这样的:

*Image* this is a test,
hello word, this is a test 

         this is a test, hello
*Image*  world, this is a test
         hello world

我的方法:

protected Item createItemWithIcon(String str, Image icon)
{
    Item item = null;
        item = new ImageItem(str, icon, Item.LAYOUT_VCENTER, "", Item.HYPERLINK);
        form.append(item);
    return item;
}

I am creating an ImageItem in a midp form, however, when the text wraps to the next line the image is shifted to the top and the text appears in a new line. Any ideas how to avoid this?

Example:

*Image*
this is a a test, hello
world, this is a test

I need it to be something like this:

*Image* this is a test,
hello word, this is a test 

or

         this is a test, hello
*Image*  world, this is a test
         hello world

My method:

protected Item createItemWithIcon(String str, Image icon)
{
    Item item = null;
        item = new ImageItem(str, icon, Item.LAYOUT_VCENTER, "", Item.HYPERLINK);
        form.append(item);
    return item;
}

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

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

发布评论

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

评论(1

挽袖吟 2024-11-22 07:55:24

正如 @sajid 已经说过 Canvas 是一种选择,如果您想将某些特定文本与图像相关联,另一种选择是 CustomItem。然而,在一般情况下,无法使文本围绕图像流动。查看这篇文章,了解有关表单中 ImageItem 的详细信息,以及布局

As @sajid already said Canvas is one option, another would be CustomItem in case you want to associate some specific text with image. However in general scenario there is no way to make text flow around Image. Check this article for some detailed info on ImageItem in the form and layouts

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