Android Question justify fonts(left, right) in BCTextRun

jose luis gudino

Active Member
Licensed User
Longtime User
Hello everyone, I have this code:

B4X:
Private Sub BuildMessage (Text As String, User As String) As List
    Dim title As BCTextRun = Engine.CreateRun(User & CRLF)
    title.TextFont  = BBCodeView1.ParseData.DefaultBoldFont
    Dim TextRun As BCTextRun = Engine.CreateRun(Text&CRLF)
    Dim time As BCTextRun = Engine.CreateRun(DateTime.Time(DateTime.Now))
    time.TextFont = xui.CreateDefaultFont(10)
    time.TextColor = xui.Color_Gray
    Return Array(title, TextRun, time)
End Sub

From this example:
https://www.b4x.com/android/forum/threads/b4x-cross-platform-chat-layout-example.112649/

How can I justify the time to the right?

cap01.png


Thanks for advance
 

Alexander Stolte

Expert
Licensed User
Longtime User
How can I justify the time to the right?
B4X:
time.HorizontalAlignment = "RIGHT"
B4X:
Private Sub BuildMessage (Text As String, User As String) As List
    Dim title As BCTextRun = Engine.CreateRun(User & CRLF)
    title.TextFont  = BBCodeView1.ParseData.DefaultBoldFont
    Dim TextRun As BCTextRun = Engine.CreateRun(Text & CRLF)
    Dim time As BCTextRun = Engine.CreateRun(DateTime.Time(DateTime.Now))
    time.TextFont = xui.CreateDefaultFont(10)
    time.TextColor = xui.Color_Gray
    time.HorizontalAlignment = "RIGHT"
    Return Array(title, TextRun, time)
End Sub
 
Upvote 0

jose luis gudino

Active Member
Licensed User
Longtime User
B4X:
time.HorizontalAlignment = "RIGHT"
B4X:
Private Sub BuildMessage (Text As String, User As String) As List
    Dim title As BCTextRun = Engine.CreateRun(User & CRLF)
    title.TextFont  = BBCodeView1.ParseData.DefaultBoldFont
    Dim TextRun As BCTextRun = Engine.CreateRun(Text & CRLF)
    Dim time As BCTextRun = Engine.CreateRun(DateTime.Time(DateTime.Now))
    time.TextFont = xui.CreateDefaultFont(10)
    time.TextColor = xui.Color_Gray
    time.HorizontalAlignment = "RIGHT"
    Return Array(title, TextRun, time)
End Sub
I work perfect. I send you a coffee
 
Last edited:
Upvote 0
Top