در این قسمت از سایت ۳ نوع سورس براتون پیوست کردم برای کار با منو هایی کشویی جرفه ای
دانلود سورس
#Region Module Attributes #FullScreen: False #IncludeTitle: True #ApplicationLabel: SlidingSidebar demo #VersionCode: 1 #VersionName: #SupportedOrientations: unspecified #CanInstallToExternalStorage: False #End Region 'Activity module Sub Process_Globals 'These global variables will be declared once when the application starts. 'These variables can be accessed from all modules. End Sub Sub Globals Dim PanelWithSidebar As ClsSlidingSidebar Dim lblInfo As Label Dim ivHandle, ivShadow As ImageView Dim pnlDarken As Panel Dim lvMenu As ListView End Sub Sub Activity_Create(FirstTime As Boolean) Dim LightBrown As Int LightBrown = Colors.RGB(220, 200, 200) Activity.Color = LightBrown PanelWithSidebar.Initialize(Activity, 100%y - 70dip, 3, 2, 400, 400) PanelWithSidebar.ContentPanel.Color = LightBrown PanelWithSidebar.Sidebar.Color = Colors.RGB(117, 65, 54) PanelWithSidebar.SetOnChangeListeners(Me, "Drawer_onFullyOpen", "Drawer_onFullyClosed", "Drawer_onMove") lblInfo.Initialize("") lblInfo.Text = "Drag the handle to open/close the drawer." lblInfo.TextColor = Colors.Black lblInfo.TextSize = 24 PanelWithSidebar.ContentPanel.AddView(lblInfo, 30dip, 30dip, 100%x - 60dip, 100%y - 60dip) ivHandle.Initialize("") ivHandle.Background = LoadNinePatchDrawable("handle") PanelWithSidebar.AddOpenCloseHandle(ivHandle, 0, 100%x, 70dip, 0) lvMenu.Initialize("lvMenu") lvMenu.AddSingleLine("1st option") lvMenu.AddSingleLine("2nd option") lvMenu.AddSingleLine("3rd option") lvMenu.AddSingleLine("4th option") lvMenu.AddSingleLine("5th option") lvMenu.AddSingleLine("6th option") lvMenu.AddSingleLine("7th option") lvMenu.AddSingleLine("8th option") lvMenu.Color = Colors.Transparent lvMenu.ScrollingBackgroundColor = Colors.Transparent PanelWithSidebar.Sidebar.AddView(lvMenu, 15dip, 15dip, PanelWithSidebar.Sidebar.Width - 30dip, PanelWithSidebar.Sidebar.Height - 30dip) ivShadow.Initialize("") ivShadow.Background = PanelWithSidebar.LoadDrawable("code_lock_bottom") PanelWithSidebar.Sidebar.AddView(ivShadow, 0, 0, -1, 7dip) pnlDarken.Initialize("") pnlDarken.Color = Colors.ARGB(200, 0, 0, 0) PanelWithSidebar.Sidebar.AddView(pnlDarken, 0, 0, -1, -1) End Sub Sub Activity_Resume End Sub Sub Activity_Pause (UserClosed As Boolean) End Sub 'Gets a 9-patch drawable from the application resources Sub LoadNinePatchDrawable(ImageName As String) As Object Dim r As Reflector Dim package As String package = r.GetStaticField("anywheresoftware.b4a.BA", "packageName") Dim ID_Drawable As Int ID_Drawable = r.GetStaticField(package & ".R$drawable", ImageName) r.Target = r.GetContext r.Target = r.RunMethod("getResources") Return r.RunMethod2("getDrawable", ID_Drawable, "java.lang.int") End Sub Sub lvMenu_ItemClick (Position As Int, Value As Object) lblInfo.Text = "LAST SELECTION: " & Value PanelWithSidebar.CloseSidebar End Sub Sub Drawer_onFullyOpen Log("FULLY OPEN") End Sub Sub Drawer_onFullyClosed Log("FULLY CLOSED") End Sub Sub Drawer_onMove(IsOpening As Boolean) Log("MOVE IsOpening=" & IsOpening) Dim Transparency As Float Transparency = 1 - ((100%y - PanelWithSidebar.Sidebar.Top) / PanelWithSidebar.Sidebar.Height) pnlDarken.Color = Colors.ARGB(Transparency * 200, 0, 0, 0) End Sub