Android Question Monospace Bold Font in ListView Label

philster

Member
Licensed User
Longtime User
Hi

May be a silly question....

If I add a label in the designer with MONOSPACE font and change the style to BOLD, it displays without a problem. However, if I change the label properties of a ListView in the code to the same, then it does not display in bold.

e.g.

B4X:
    Dim lblPlace As Label
   
    lblPlace = lvPlaces.SingleLineLayout.Label
    lblPlace.Color = signColour
    lblPlace.TextSize = 22
    lblPlace.Typeface = Typeface.CreateNew(Typeface.MONOSPACE, Typeface.STYLE_BOLD)
    lblPlace.TextColor = Colors.White

If I change the font to SAN_SERIF it works. Is it just a quirk with MONOSPACE on ListView labels or possibly because I'm using an old version of B4A (2.52)?

Just thought I'd ask - I could create a custom ListView but is overkill for what I need.
 

mangojack

Well-Known Member
Licensed User
Longtime User
How are you changing the ListView SingleLineLayout.Label properties ?

this works ..
B4X:
lvPlaces.SingleLineLayout.Label.Color = signColour
lvPlaces.SingleLineLayout.Label.Typeface = Typeface.MONOSPACE
lvPlaces.SingleLineLayout.Label.Typeface = Typeface.DEFAULT_BOLD
lvPlaces.SingleLineLayout.Label.TextSize = 22
lvPlaces.SingleLineLayout.Label.TextColor = Colors.White
 
Upvote 0

philster

Member
Licensed User
Longtime User
Hi

Thanks for the reply. I'll give it a try at some point but doesn't that override the typeface with the "default" font emboldened rather than the monospace?

I was just trying to use the fixed width font to display two values neatly side by side (but separated) in a ListView - the bold monospace font looked nicer. After some messing around I managed to get the two values horizontally using a TwoLinesLayout, which is even neater, so I'm just using the default bold typeface.

Cheers
 
Upvote 0
Top