I found that under Android < 5.0 - the monospaces font of a label is OK on the widget.
But the same label under Android 5 - is not monospaced.
How to show on a widget some text table of 1 ... 10 lines in 2 columns dinamically?
Used such sub for formatting:
with the format = "%-30s %s %n"
But the same label under Android 5 - is not monospaced.
How to show on a widget some text table of 1 ... 10 lines in 2 columns dinamically?
Used such sub for formatting:
B4X:
Sub FormatString(str1 As String, str2 As String, strformat As String) As String
'Create a Stringbuilder (it's much faster for appending strings)
Dim SB As StringBuilder
SB.Initialize
'Create the Formatter Object
Dim Format As JavaObject
Format.InitializeStatic("java.lang.String")
'Create an array of arrays that holds our data.
'We could have been read from a CSV file using StringUtils and converted to an array of arrays using Regex.Split
'NOTE: the array must be of type Object
Dim Data(1) As Object
Data(0) = Array As Object(str1, str2)
Dim FormatStr As String = strformat
For Each Line() As Object In Data
SB.Append(Format.RunMethod("format",Array As Object(FormatStr,Line)))
Next
Return SB.ToString
End Sub
with the format = "%-30s %s %n"
Last edited: