Android Question Fontawesome Label Height inside TabStripViewPager

Angel Garcia

Member
Licensed User
Hi All,
Is there a way to measure the Label Height with fontawesome inside the TabStrip?, this is for adjust TextSize purposes.
I already tried with canvas and su multiline, but i always get a -1, i get correctly the Width after setting it.
I also tried to get the "tabsHeight" object of the tabstrip with no success.
Any ideas?
Thanks in advance!
 

Angel Garcia

Member
Licensed User
You don't really need to measure it.
Yep, what i was trying to do is no measure the tab height in order to set this same size in the label height inside the tabstrip.
This is because in some cell phone screens it sees the fontawesome character truncated. See below code:

B4X:
k=0
For Each lbl As Label In GetAllTabLabels(ExploStrip)
            lbl.Typeface = Typeface.FONTAWESOME
            lbl.TextSize=20'i set a text size (in some screens shows Ok, in others sees truncated)
            lbl.Width=25%x
            lbl.Padding=Array As Int(0,0,0,0)
            Select k
                Case 0
                    lbl.TextColor=Colors.RGB(3, 155, 229)
                  
                Case Else
                    lbl.TextColor=Colors.RGB(220,220,220)
                  
            End Select
          
            k=k+1
          
            Dim anCwi As Float=canVar.MeasureStringWidth(lbl.Text,Typeface.FONTAWESOME,lbl.TextSize)'i got the string width Ok
            Dim alTHe As Float=canVar.MeasureStringHeight(lbl.Text,Typeface.FONTAWESOME,lbl.TextSize)' i got a -1 string height, this is the problem
          
            If anCwi>lbl.Width Or alTHe>lbl.Height Then
               'this is another logic to adjust text size to fit inside the label, not shown here, but cant work properly because of the -1 value of the height string
              
            End If
          
        Next
 
Upvote 0
Top