formsjava-meimageiconmidp

J2ME Midp Form - ImageItem - align image and text


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;
}

Solution

  • 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