Android Question CustomListView Monospace Font Not Working

mmieher

Active Member
Licensed User
Longtime User
In the designer, I set the Typeface for a CLV as MONOSPACE, but it is not presenting a monospace font.

Any ideas?
 

DonManfred

Expert
Licensed User
Longtime User
just clv1.AddTextItem
Have a look at this method in the class.
You ARE adding objects to the CLV. In this case a Label

change the class methods similar to this...

B4X:
'Adds a text item. The item height will be adjusted based on the text.
Public Sub AddTextItem(Text As String, Value As Object)
    InsertAtTextItem(items.Size, Text, Value)
End Sub

'Inserts a text item at the specified index.
Public Sub InsertAtTextItem(Index As Int, Text As String, Value As Object)
    Dim pnl As Panel
    pnl.Initialize("")
    Dim lbl As Label
    lbl.Initialize("")
    pnl.AddView(lbl, 5dip, 2dip, sv.Width - 5dip, 20dip)
    Dim font As Typeface
    lbl.Typeface = font.MONOSPACE
    lbl.Text = Text
    If DefaultTextBackground <> Null Then
        pnl.Background = DefaultTextBackground
    Else
        pnl.Color = DefaultTextBackgroundColor
    End If
    Dim minHeight As Int
    minHeight = su.MeasureMultilineTextHeight(lbl, Text)
    lbl.Height = Max(50dip, minHeight)
    InsertAt(Index, pnl, lbl.Height + 2dip, Value)
End Sub
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…