Listview maximum text size?

rondunn

Member
Licensed User
Longtime User
I'm trying to make a two line listview with large text on each line.

It appears that there is a maximum size for the text in label and secondlabel, as my text is being clipped.

If this is correct, what is the maximum size? If not correct, what am I doing wrong in the following code?

B4X:
Sub Activity_Create(FirstTime As Boolean)

   lv.Initialize("lv")  
   lv.TwoLinesLayout.ItemHeight = 120dip
   lv.TwoLinesLayout.Label.TextSize = 40
   lv.TwoLinesLayout.SecondLabel.TextSize = 40
   For i = 1 To 100        
      lv.AddTwoLines ("Item #" & i,"This is the second line")    
      Next    
   Activity.AddView(lv, 0, 0, 100%x, 100%y)
   
   End Sub
 

rondunn

Member
Licensed User
Longtime User
NJDude, I tried that and it did not make any difference.

My first attempt used 'dip' measurements, but then I read in the Listview tutorial that these were not required for the label heights so I took off the 'dip' to see what happened.

No change.

I doubt that the device makes a difference here, but I am running Android 4.04 on a Galaxy Tab 7.7.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
You need to adapt the dimensions and positions of the ListView Labels to the text size.
Or you need to adapt the text size to the ListView Labels sizes.
This code should show what you expect.
B4X:
lv.TwoLinesLayout.Label.TextSize = 40
lv.TwoLinesLayout.Label.Top = 0
lv.TwoLinesLayout.Label.Height = 50dip
lv.TwoLinesLayout.Label.Gravity = Bit.Or(Gravity.LEFT, Gravity.CENTER_VERTICAL)

lv.TwoLinesLayout.SecondLabel.TextSize = 40
lv.TwoLinesLayout.SecondLabel.Top = lv.TwoLinesLayout.Label.Height
lv.TwoLinesLayout.SecondLabel.Height = 50dip
lv.TwoLinesLayout.SecondLabel.Gravity = Bit.Or(Gravity.LEFT, Gravity.CENTER_VERTICAL)

lv.TwoLinesLayout.ItemHeight = lv.TwoLinesLayout.Label.Height + lv.TwoLinesLayout.SecondLabel.Height

For i = 1 To 100        
    lv.AddTwoLines ("Item #" & i, "This is the second line")    
Next
Otherwise you must 'play' with the Top and Height properties.

Best regards.
 
Upvote 0
Top