iOS Code Snippet iDSTabLayout

Good morning! I think B4i and B4a are really amazing products. In order to develop easier application cross-platoform, i made a little "port" of Android DSTabLayout. I'm working to add more and more methods and optimize it.

NB: SetViewPager must be call as last method
NB2: DSTabLayout is a custom view, so you should add it on designer
Simple code to use it:

B4X:
Dim listmod As List = Array As String("LV_30","LV_31","LV_32","LV_33","LV_34")
    For i = 0 To listmod.Size-1
        Dim p As Panel
        p.Initialize("")
        p.Color = 0xFF313131
        Dim scv As ScrollView
        scv.Initialize("",Main.MainPage.RootPanel.Width,8dip)
        p.AddView(scv,0,0,Main.MainPage.RootPanel.Width,Main.MainPage.RootPanel.Height-48dip)
        DSTab.AddPage2(p)
    Next
 
    DSTab.TabMode = DSTab.Mode_Fixed
    DSTab.SetTabTextColors(0xffffffff,0xffd0d0d0)
    DSTab.IndicatorVisible = False
    DSTab.ColorTabber = Colors.ARGB(255, 3, 150, 204)
 
    For i = 0 To listmod.Size-1
        Dim s As String = listmod.Get(i)
        DSTab.SetTabText(i,s.Replace("_"," "))
    Next
 
    DSTab.SetViewPager
 

Attachments

  • DSTabLayout.bas
    6 KB · Views: 373
Top