Android Question Fit label in activity with strings

Blue.Sky

Active Member
Licensed User
Longtime User
Hi
I have a 1000 character and need to show it in my app
I don't want to show all character in one label with scroll
Actually i need to divide 1000 character to many panel and show it in AHViewPager
Example 200 character in first panel,200 character in next panel and other panel
200 character is fit for label
I add LineSpace and Paddinglabel on label and and get MeasureMultilineTextHeight of label
and divide result with activity height to get character count each label in panel
But i cannot get correct result (however result is correct when i don't affect LineSpace or PaddingLabel)

In below code i try to measure Text height and divide with activity height for get character count placed in Label
B4X:
    Dim lb As Label
    lb.Initialize("")
    lb.TextSize = FontSize
    lb.Typeface = Typeface.LoadFromAssets("tahoma.ttf")
    Library.LabelSpace(lb,LabelSpace)
    Library.PaddingView(lb,Padding,Padding,Padding,Padding)
    Activity.AddView(lb,0,0,100%x,100%y)
  
    CountPage = su.MeasureMultilineTextHeight(lb,content) / 100%y  ' get count page
    textCount = content.Length / CountPage 'get text count placed in each label in panel
Thank you guys.
 
Top