B4J Question How to add B4JTextFlow result to ListView with left alignment?

specci48

Well-Known Member
Licensed User
Longtime User
Hello,

I'm trying to add the result of a B4JTextFlow into a ListView. It works, but the result is always centered.
I cannot figure out how to align it 'left'. What's the right way to do it?

B4X:
    Dim richtext As B4JTextFlow
    richtext.Initialize
    richtext.Append("Test").SetStrikethrough(True)
    ListView1.Items.Add(richtext.CreateTextFlow)
List.jpg
 

teddybear

Well-Known Member
Licensed User
Hello,

I'm trying to add the result of a B4JTextFlow into a ListView. It works, but the result is always centered.
I cannot figure out how to align it 'left'. What's the right way to do it?

B4X:
    Dim richtext As B4JTextFlow
    richtext.Initialize
    richtext.Append("Test").SetStrikethrough(True)
    ListView1.Items.Add(richtext.CreateTextFlow)
View attachment 168380
You can set the alignment to left with CSSUtils
B4X:
    Dim richtext As B4JTextFlow
    richtext.Initialize
    richtext.Append("Test").SetStrikethrough(True)
    Dim p As B4XView=richtext.CreateTextFlow
    CSSUtils.SetStyleProperty(p, "-fx-text-alignment", "left")
    ListView1.Items.Add(p)

left.png
 
Upvote 0
Top