Android Question DSTabLayout CharSequence

Emme Developer

Well-Known Member
Licensed User
Longtime User
Hi! I'm using DSTabLayout, and i set the text using CharSequence, but i doesn't seem to work.
This is my code, but textsize doesn't change. Is there any error in my code or?

B4X:
For i = 0 To lstContent.Size-1
        Dim cs As CSBuilder
        cs.Initialize.Size(7).Append(lstContent.Get(i)).PopAll
        TabLayout.SetTabText(i,cs)
    Next
 

Daniel Uribe

Member
Licensed User
Longtime User
Hi, this is working very good..

B4X:
Dim cs,cs1 As CSBuilder
    cs.Initialize.Typeface(Typeface.DEFAULT_BOLD)
    cs.Image(LoadBitmap(File.DirAssets, "ic_soccer.png"), 20dip, 20dip, True).Append(" Soccer").PopAll
  
    cs1.Initialize.Typeface(Typeface.DEFAULT_BOLD)
    cs1.Image(LoadBitmap(File.DirAssets, "ic_basketball.png"), 20dip, 20dip, True).Append(" Basket").PopAll

  
    TabStrip1.LoadLayout("pagesoccer", cs)
    TabStrip1.LoadLayout("pagebasket", cs1)
  
    For Each lbl As Label In GetAllTabLabels(TabStrip1)
        lbl.Typeface = Typeface.FONTAWESOME
    Next
  
    Dim lbl As Label = GetAllTabLabels(TabStrip1).Get(0)
    lbl.Text = cs
  
    Dim lbl1 As Label = GetAllTabLabels(TabStrip1).Get(1)
    lbl1.Text = cs1

B4X:
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

Source: https://www.b4x.com/android/forum/threads/tabstripviewpager-with-fontawesome-material-icons.73885/


I hope this can help you.
 
Upvote 0
Top