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 :

Screenshot_20200329-100918.jpg

to this one :

Screenshot_20200329-100938_WhatsApp.jpg

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

Administrator
Staff member
Licensed User

You can find GetAllTabLabels here: https://www.b4x.com/android/forum/t...ger-better-viewpager.63975/page-2#post-408977
It depends on JavaObject and Reflection.
 

epneeh

Member

You can find GetAllTabLabels here: https://www.b4x.com/android/forum/t...ger-better-viewpager.63975/page-2#post-408977
It depends on JavaObject and Reflection.
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
 
Top