Android Question B4xPages and AS Tab Menu

Michael1968

Active Member
Licensed User
Longtime User
Hi all,
I'm playing a little bit with B4Xpages.
How can i use AS Tab Menu ?

i have written a quick code but it does not work.
after Start it shows me only page2 and it did not change

thx
Michael
 

Attachments

  • AS Tab Menu Example.zip
    14.1 KB · Views: 143

Alexander Stolte

Expert
Licensed User
Longtime User
For 3 tabs you need 3 panels, which you place above the ASTab menu.

When the B4XMainPage is called up you load your layouts into the panels and when you press a tab you simply bring the panel you want to display to the foreground.

Put this in B4XPage_Created:
B4X:
Sleep(0)
ASTabMenu_horizontal.AddTab(xui.Color_ARGB(255,39, 174, 97),"Page 1",ASTabMenu_horizontal.FontToBitmap(Chr(0xF015),False,30,xui.Color_White),"")
    ASTabMenu_horizontal.AddTab(xui.Color_ARGB(152,39, 174, 97),"Page 2",ASTabMenu_horizontal.FontToBitmap(Chr(0xF179),False,30,xui.Color_White),"")
    ASTabMenu_horizontal.AddTab(xui.Color_ARGB(255,39, 174, 97),"Page 3",ASTabMenu_horizontal.FontToBitmap(Chr(0xF11B),False,30,xui.Color_White),"")

    Pane1.BringToFront
    
    'load your layouts to the panels!
    Pane1.LoadLayout("yourlayout1")
    Pane2.LoadLayout("yourlayout2")
    Pane3.LoadLayout("yourlayout3")

and this for the tab clicks:
B4X:
Sub ASTabMenu_horizontal_TabClick(index As Int)
    If index = 0 Then
        Pane1.BringToFront
    Else if index = 1 Then
        Pane2.BringToFront
    Else if index = 2 Then
        Pane3.BringToFront
    End If
End Sub
 

Attachments

  • CrossPlatformProject.zip
    3.7 KB · Views: 217
Upvote 0
Top