J2ME Midp Form - ImageItem - 对齐图像和文本
我正在以 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如 @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