# wMMD-Android: Positioning of nuiImageElement

**URL:** <https://techcommunity.softwareag.com/t/wmmd-android-positioning-of-nuiimageelement/100373>\
**Category:** Forum\
**Tags:** mobile\
**Created:** [February 22, 2012, 7:52pm UTC](https://techcommunity.softwareag.com/t/wmmd-android-positioning-of-nuiimageelement/100373 "2012-02-22T19:52:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_Mamsch](https://avatars.discourse-cdn.com/v4/letter/d/e8c25b/32.png) [@David\_Mamsch](https://techcommunity.softwareag.com/u/David_Mamsch)\
**Post date:** [February 22, 2012, 7:52pm UTC](https://techcommunity.softwareag.com/t/wmmd-android-positioning-of-nuiimageelement/100373/1 "2012-02-22T19:52:17Z")

</div>

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  
element.setX(0);  
start\_view.add(element);

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?

Regards,  
David

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [February 22, 2012, 10:02pm UTC](https://techcommunity.softwareag.com/t/wmmd-android-positioning-of-nuiimageelement/100373/2 "2012-02-22T22:02:49Z")

</div>

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.

Regards,

Nick.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [April 2, 2021, 3:01pm UTC](https://techcommunity.softwareag.com/t/wmmd-android-positioning-of-nuiimageelement/100373/3 "2021-04-02T15:01:53Z")

</div>


