Android Question Left and right Alignment

Emme Developer

Well-Known Member
Licensed User
Longtime User
Hi to all! I have a label, and i want to set a part of text in left alignment, and 2nd part of text in right alignment. I tried to use CSBuilder, but i don't know why right alignment doesnt work. Any tips? Thanks

B4X:
    Dim cs As CSBuilder : cs.initialize
    cs.Typeface(Utils.SansLight).Alignment("ALIGN_NORMAL").Color(Utils.Black).Append(Utils.loc.Localize("utils2")).PopAll
    cs.Typeface(Utils.SansSemibold).Alignment("ALIGN_OPPOSITE").Color(Utils.Azzurro).Append("AkunaMatata..").PopAll
    lblRete.Text = cs
 

Computersmith64

Well-Known Member
Licensed User
Longtime User
Hi to all! I have a label, and i want to set a part of text in left alignment, and 2nd part of text in right alignment. I tried to use CSBuilder, but i don't know why right alignment doesnt work. Any tips? Thanks

B4X:
    Dim cs As CSBuilder : cs.initialize
    cs.Typeface(Utils.SansLight).Alignment("ALIGN_NORMAL").Color(Utils.Black).Append(Utils.loc.Localize("utils2")).PopAll
    cs.Typeface(Utils.SansSemibold).Alignment("ALIGN_OPPOSITE").Color(Utils.Azzurro).Append("AkunaMatata..").PopAll
    lblRete.Text = cs
I'm not sure if you can have opposing alignments in the same string.

- Colin.
 
Upvote 0

Computersmith64

Well-Known Member
Licensed User
Longtime User
From what I read in the CSBuilder tutorial, it seems that CSBuilder implements the Android CharSequence interface (https://developer.android.com/reference/java/lang/CharSequence.html). I guess whether or not it can do what you want depends on whether that particular functionality is implemented. If you haven't been able to get it to work, it would seem not - but Erel is probably the person who can answer that definitively.

- Colin.
 
Upvote 0

Emme Developer

Well-Known Member
Licensed User
Longtime User
Yes of course. If i can't do this, i will put 2 label with opposite allignment at same position and width. Easy :)
 
Upvote 0
Top