Android Question [SOLVED] TabStripViewPager equal width and center text

epneeh

Member
Hello,

how to center a TabStripViewPager text tab then width equally to screen

from this :



to this one :



my code :
B4X:
Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("main")
   
    tabstrip1.LoadLayout("1","Absensi")
    tabstrip1.LoadLayout("2","Peta Pegawai")
   
    Activity.AddMenuItem("Keluar","Keluar")
    Activity.AddMenuItem("About","About")

End Sub

Any help appreciate.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0

epneeh

Member

Hi erel thanks for your fast reply

yes indeed it depends on GetAllTabLabels function and JavaObject also Reflection library
here what i do
B4X:
Activity.LoadLayout("main")
    
    tabstrip1.LoadLayout("1","Absensi")
    tabstrip1.LoadLayout("2","Peta Pegawai")
    
    For Each lbl As Label In GetAllTabLabels(tabstrip1)
        lbl.TextSize=14
        lbl.Width=50%x   
    Next

it work like charm now, thanks again
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…