I have a problem to center an image (ImageItem) vertically with FORM. I developp with MIDP1.0. I could center the image horizontally. FORM form = new FORM("toto"); ImageItem item = new ImageItem("" , img1, ImageItem.LAYOUT_CENTER , "") ; form.append(item);
Help me
OULD Cheers
We are ones that build the world, thus build it well.
Why don't you try to add LAYOUT_NEWLINE_BEFORE also:
If that doesn't do the trick may be you should consider using Canvas for that screen. You can extend a class from javax.microedition.lcdui.Canvas. In the paint(Graphics g) method (that you must override) just draw the Image using the Graphics parameter.
Thank you. I tested your solution about a FORM to center a item vertically but it seems it doen't work. I prefer a solution with FORM. It'is right that a Canvas can solve my problem.I wondering if the Canvas solution may require more resources (memory ???) for example.
Cheers
OULD
We are ones that build the world, thus build it well.
If there was a way to center verticaly an Image on a Form in MIDP 1.0 probably it would be shorter to code than the Canvas solution, which means that the jar size will be smaller. The jar size is always a problem in MIDP 1.0 phones. But then again I don't know of such way. The LAYOUT_NEWLINE_BEFORE cannot center the Image vertically. At best it will move it down a little bit. With Canvas you can center it without problem.