开发者

J2ME Midp Form - ImageItem - align image and text

开发者 https://www.devze.com 2023-03-12 07:05 出处:网络
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?

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开发者_Go百科 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;
}


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

0

精彩评论

暂无评论...
验证码 换一张
取 消