Center the text of a SpanLabel

137 views
Skip to first unread message

robert....@gmail.com

unread,
Jun 15, 2014, 6:50:48 PM6/15/14
to codenameone...@googlegroups.com

Hello All,

I am kind of new to android development and CodenameOne, so this may be a stupid question. But how would one go about centering the text of a SpanLabel.

The scenario is that I am trying to create a custom Error dialog that has a varying length message and thus I would like a SpanLabel so that all text is viewable no matter what. But I would like to have the text center aligned instead of left justified like it is in the following pictures. Any help is greatly appreciated. Thanks.

    


Shai Almog

unread,
Jun 16, 2014, 2:08:35 AM6/16/14
to codenameone...@googlegroups.com, robert....@gmail.com
Hi,
you need to style the internal UIID. Span label is a composite component comprised of a Container, TextArea and a Label (for the icon) see http://www.codenameone.com/3/post/2014/04/leading.html

So you need to style the UIID of the TextArea in the center which currently has the Label style by default. To change that UIID to something else just invoke setTextUIID(withYourUIID)

robert....@gmail.com

unread,
Jun 16, 2014, 4:17:10 PM6/16/14
to codenameone...@googlegroups.com, robert....@gmail.com
Oh, I see, that makes a lot more sense now.

Thanks very much!
Reply all
Reply to author
Forward
0 new messages