wMMD-Android: Positioning of nuiImageElement

Hi all,
could anyone please give a hint on how the positioning of nuiImageElements for Android works?

Let’s say we put such an element on the start_view of the nativeUIHelloWorld sample.
Then we have something like:

nUIImageElement element = new nUIImageElement(-1, image);
element.setWidth(image.getWidth()); // maybe not necessary for android

The image would then appear left-aligned in Phoney but somewhere in the middle of the screen for Android.
To have the image left-aligned on an android device, I would need to “setX” it to a strange number like -336 …
it then is not even visible on Phoney any more …

Could anyone help on this?


Hi David,

setWidth is likely to be modified to throw an Exception further down the line - the width/height of an ImageElement is driven by the image’s dimensions, not by an integer setter value passed in. For what you’re trying, I suggest using the setAlign method, as demonstrated on the “Images” view in NativeUIDemo - the default alignment is ‘center’ on the screen.