The open source project is no longer maintained and there are compatibility issues with newer versions of Android. It is recommended to use B4XDrawer instead.
This is a wrapper for jfeinstein10 SlidingMenu open source project. This is a popular implementation of sliding menus. Note that you can add any layout you like in each of the side menus.
It requires B4A v6+
Example code:
This is a wrapper for jfeinstein10 SlidingMenu open source project. This is a popular implementation of sliding menus. Note that you can add any layout you like in each of the side menus.
It requires B4A v6+
Example code:
B4X:
Sub Process_Globals
End Sub
Sub Globals
Dim sm As SlidingMenu
End Sub
Sub Activity_Create(FirstTime As Boolean)
sm.Initialize("sm")
Dim offset As Int = 100dip
sm.BehindOffset = offset
sm.Mode = sm.BOTH
Dim lv1 As ListView
lv1.Initialize("lv1")
For i = 1 To 10
lv1.AddSingleLine("Action " & i)
Next
sm.SecondaryMenu.AddView(lv1, 0, 0, 100%x - offset, 100%y)
Dim b1, b2 As Button
b1.Initialize("b1")
b2.Initialize("b2")
b1.Text = "Button1"
b2.Text = "Button2"
sm.Menu.AddView(b1, 10dip, 10dip, 100%x - offset - 20dip, 50dip)
sm.Menu.AddView(b2, 10dip, 60dip, 100%x - offset - 20dip, 50dip)
End Sub
Sub lv1_ItemClick (Position As Int, Value As Object)
Log(Value)
sm.HideMenus
End Sub
Sub Activity_KeyPress (KeyCode As Int) As Boolean
If KeyCode = KeyCodes.KEYCODE_BACK AND sm.Visible Then
sm.HideMenus
Return True
End If
Return False
End Sub
Sub B1_Click
Log("b1_click")
sm.HideMenus
End Sub
Sub B2_Click
Log("b2 click")
sm.HideMenus
End Sub
Attachments
Last edited: