This line of code does not work

dreamworld

Active Member
Licensed User
Longtime User
ListView1.TwoLinesAndBitmap.SecondLabel.Typeface=Typeface.CreateNew (Typeface.DEFAULT ,Typeface.STYLE_ITALIC)

I have tested it, without any effect.
Is there anyone who knows the reason why.

The following line can work:
ListView1.TwoLinesAndBitmap.SecondLabel.TextSize =20
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Note that you should post questions in the questions forum.

Try this code:
B4X:
Sub Activity_Create(FirstTime As Boolean)
   Dim lv As ListView
   lv.Initialize("")
   Activity.AddView(lv, 0, 0, 200dip, 300dip)
   lv.TwoLinesAndBitmap.SecondLabel.Typeface = Typeface.CreateNew(Typeface.DEFAULT, Typeface.STYLE_ITALIC)
   lv.AddTwoLinesAndBitmap("aaaaaa", "aaaaaa", Null)
End Sub
 

dreamworld

Active Member
Licensed User
Longtime User
Ok, I will post questions in the questions forum later.

But what's the difference between your code and mine?
I can't see any differences.
The code still can't work. And the font style of the text is still regular.
It seems that the default font style of your ListView is bold. And that is not changeable.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
This is how it looks here:
SS-2013-05-08_11.50.09.png


The second label is indeed in italic style.

Note that CustomListView class is easier to work with and especially customize.
 

moster67

Expert
Licensed User
Longtime User
And the font style of the text is still bold, not regular or italic.

I think this has been discussed before. I recall that I also was unable to get italic working setting the style by code. Maybe it was related to a specific version of Android - I don't remember but I was not able to resolve it.
 
Last edited:
Top