Android Question Align Strings in ListView Line

Bob Spielen

Active Member
Licensed User
Hi,
Is it possible to align string in a listview (2lines)? See attached picture
Appreciate some help.
In advance thanks a lot!
 

Attachments

  • ListViewIssue.jpg
    ListViewIssue.jpg
    120.3 KB · Views: 186

DonManfred

Expert
Licensed User
Longtime User
No.

- You can use a CustomListView. Here you can create any Layout you want
- You can use a Font with a fixed charlength (Courier New).
- You can use a fixed typedface for the beginning of the line followe by the amount with a different font using the CSBuilder

B4X:
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.

    Private lv As ListView
    Private cs As CSBuilder
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("Layout1")

    For i = 0 To 9
        lv.AddTwoLines(cs.Initialize.Typeface(Typeface.MONOSPACE).Append("Article....      ").PopAll.Typeface(Typeface.DEFAULT).Color(Colors.Blue).Append("$4.498").PopAll,"2nd line...")
    Next

End Sub
 
Upvote 0
Top