Android Question TabText 2 Line Using TabStripViewPager

mayahandayani

Member
Licensed User
Hello, I want to set TabText 2 line.
My code like this :
B4X:
TabStrip1.LoadLayout("laywvfaq", periode)

(note : log "periode" like this :
POIN KEMERDEKAAN AGUSTUS -
SEPTEMBER 2024)

But still 1 line, any solution?
 
Last edited:

mangojack

Expert
Licensed User
Longtime User
Try This ..

In the Designer I set Tab Height to 50.

B4X:
Dim Periode As String = $"POIN KEMERDEKAAN AGUSTUS ${CRLF}-SEPTEMBER 2024)"$

    TabStrip1.LoadLayout("laywvfaq", Periode)
 
    For Each lbl As Label In GetAllTabLabels(TabStrip1)
        lbl.SingleLine = False
    Next

Public Sub GetAllTabLabels (tabstrip As TabStrip) As List
   Dim jo As JavaObject = tabstrip
   Dim r As Reflector
   r.Target = jo.GetField("tabStrip")
   Dim tc As Panel = r.GetField("tabsContainer")
   Dim res As List
   res.Initialize
   For Each v As View In tc
     If v Is Label Then res.Add(v)
   Next
   Return res
   
End Sub

The Code for GetAllTabLabels was copied from here... (It requires inclusion of Reflection Lib)
 
Last edited:
Upvote 0

mayahandayani

Member
Licensed User
Try This ..

In the Designer I set Tab Height to 50.

B4X:
Dim Periode As String = $"POIN KEMERDEKAAN AGUSTUS ${CRLF}-SEPTEMBER 2024)"$

    TabStrip1.LoadLayout("laywvfaq", Periode)
 
    For Each lbl As Label In GetAllTabLabels(TabStrip1)
        lbl.SingleLine = False
    Next

Public Sub GetAllTabLabels (tabstrip As TabStrip) As List
   Dim jo As JavaObject = tabstrip
   Dim r As Reflector
   r.Target = jo.GetField("tabStrip")
   Dim tc As Panel = r.GetField("tabsContainer")
   Dim res As List
   res.Initialize
   For Each v As View In tc
     If v Is Label Then res.Add(v)
   Next
   Return res
  
End Sub

The Code for GetAllTabLabels was copied from here... (It requires inclusion of Reflection Lib)
I see, thanks your for your help!
 
Upvote 0
Top