lang="b4x"
For i = 1 To maxCol
Dim L As B4XView = Labels.Get(i).As(B4XView)
L.Text=Txt(nLine+m) 'Labels.Get(i).As(B4XView).Text
L.Height = -1
If i = 2 Then 'format of column 2
Dim jo As JavaObject = L
jo.RunMethod("setTextAlignment", Array("RIGHT"))
L.font = fx.CreateFont("", 14, True, False)
L.TextColor = xui.Color_Red
End If
m=m+1
Next
Using the above code I get this result in BBCODEVIEW under B4J:
Where text in column 2 should be bold, red and right aligned, but this seemd works only to work when the underlying label is multiline.
Why does it not work when the text fits on a single line? Does this have to do with Array("RIGHT")?
take a look at this link
i think you need vertical and horizontal alignment, not just horizontal. (although i would have expected a signature mismatch when you run the method.)
My table is not a conventional table, but a workaround for a table in BBCodeView which normally allows you only to set MaxWidth and Alignment.
If a text is longer than the Maxwidth then all cells thereafter are chased to the right and the table no longer looks like a table with neatly aligned columns.
This is why I place the texts first into labels and then add these as snapshots and views to the BBCode.
There is probably a more elegant way to achieve this, but my programming skills and command of Java have limits (obviously).