Creating custom UIIDs

103 views
Skip to first unread message

Brian Karoney

unread,
Jul 8, 2014, 7:14:45 AM7/8/14
to codenameone...@googlegroups.com
Hi Guys,

 I have a couple of questions regarding custom UIIDs.

1. What is the best approach if I want to create a circular UIID to act as an image placeholder, I've tried using rounded borders and got some disastrous results...
2. How do I set a background image via code. E.g for a label -> findMyLabel().setBgImage()..... I'm assuming this is possible? Please advise.
3. I created a custom list renderer with custom uiids for the components. I assigned pressed and selected states for the components. However, when I test it on android, it loses the pressed and selected states for the uiids. This makes the list look really bad when and item is selected.
4. I am dealing with a custom list renderer with a textarea as one of the components. When I load items onto the list, the text in the textarea section is cut i.e only a portion of the text appears. Sometimes however, the text displays fully...this is an unusual behaviour that I am not able to resolve.

I am sorry for the lengthy text, hope its clear. Looking forward to your response, thanks all.


Onyemaechi Okafor

unread,
Jul 8, 2014, 9:24:29 AM7/8/14
to codenameone...@googlegroups.com

Hi, For circular UIID. This is what I do, I created a mask as shown above, added the mask using the multi image feature of the gui builder. renamed it to something like avatarMaskImage. notice the Image in the word "avatarMaskImage" the naming convention makes it discoverable as an image when you want to add an image constant to the GUI Builder. add a new constant called "avatarMaskImag" for example and set it to an image, it should show up in the combobox. Whenever you want to use the mask, go the properties of the component and you will see mask.you can set it to the constant defined earlier. The end result is something like this

Shai Almog

unread,
Jul 8, 2014, 10:26:07 AM7/8/14
to codenameone...@googlegroups.com
1. For obvious reasons 9-piece borders don't work well with round UI's.
2. Yes you can.
3. Override the borders with Empty
4. I suggest using the rendererPrototype for the list

Brian Karoney

unread,
Jul 12, 2014, 5:38:16 AM7/12/14
to codenameone...@googlegroups.com
Thanks, it worked quite well.
Reply all
Reply to author
Forward
0 new messages