B4A Library [Class] SlidingSidebar

Informatix

Expert
Licensed User
Longtime User
That means you try to load a resource that does not exist on the device. Solution: either you choose a resource that exists on all Android platforms, or you don't use a system resource and you embed the image in your assets.
 

An Schi

Well-Known Member
Licensed User
Which images are needed by your class i would have to put to assets?
If i put them to assets, will i have to change their paths in your class?
 

Informatix

Expert
Licensed User
Longtime User
Which images are needed by your class i would have to put to assets?
If i put them to assets, will i have to change their paths in your class?
My class contains the LoadDrawable function but does not load any resource with it and does not require any image (in fact, this function should be in the demo code and not in the class). It's your code that loads the resource with LoadDrawable and use it. So you know better than me what to fix and where.
 

An Schi

Well-Known Member
Licensed User
As i said - the error doesn't show up on my phones, so it is hard for me to know where to fix
I'm not at my PC, but if i remember correctly the only thing i have in my code is something with 'left-shadow', which indeed i did copy from your demo.
When i'm at home i will go through my code again and check where "i" try to load images

Thx for your support
 

An Schi

Well-Known Member
Licensed User
How can i include the "jog_tab_bar_right_end_normal" into my app or assets or whatever, so it is not depending on the android system?
Can i create it as my "own" drawable somehow?
 

An Schi

Well-Known Member
Licensed User
Ok, i have it. I tried putting it to different places but get errors everytime.
Sorry for being so noobish or blind - but where do i have to put it and how do i load it?
 

An Schi

Well-Known Member
Licensed User
I have it working! Used Erels tutorial for nine patch

Thanks Informatix for creating and sharing this and thanks for giving support after 4 years!!
Donation is on the way!
 

desof

Well-Known Member
Licensed User
Longtime User
How can I make the menu emerge when I press a button that is elsewhere on the screen, for example in the center?

Example
Implement pop-up menu appearance when Botton1 is pressed

B4X:
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Private Button1 As Button
    Dim FakeActionBar, UnderActionBar As Panel
    Dim PanelWithSidebar As ClsSlidingSidebar
    Dim lvMenu As ListView
    Dim lblInfo As Label
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("test")
   
    Button1.SetBackgroundImage(LoadBitmap(File.DirAssets, "menu.png"))
   
'    Dim BarSize As Int: BarSize = 60dip
'    FakeActionBar.Initialize("")
'    FakeActionBar.Color = Colors.RGB(20, 20, 100) 'Dark blue
'    Activity.AddView(FakeActionBar, 0, 0, 100%x, BarSize)
''   
'    Dim LightCyan As Int: LightCyan = Colors.RGB(0, 95, 170)
'    UnderActionBar.Initialize("")
'    UnderActionBar.Color = LightCyan
'    Activity.AddView(UnderActionBar, 0, BarSize, 100%x, 100%y - BarSize)
''   
'    PanelWithSidebar.Initialize(UnderActionBar, 190dip, 2, 1, 500, 500)
'    PanelWithSidebar.ContentPanel.Color = LightCyan
'    PanelWithSidebar.Sidebar.Background = PanelWithSidebar.LoadDrawable("popup_inline_error")
'    PanelWithSidebar.SetOnChangeListeners(Me, "Menu_onFullyOpen", "Menu_onFullyClosed", "Menu_onMove")
'
'    lvMenu.Initialize("lvMenu")
'    lvMenu.AddSingleLine("1st option")
'    lvMenu.AddSingleLine("2nd option")
'    lvMenu.AddSingleLine("3rd option")
'    lvMenu.SingleLineLayout.Label.TextColor = Colors.Black
'    lvMenu.Color = Colors.Transparent
'    lvMenu.ScrollingBackgroundColor = Colors.Transparent
'    PanelWithSidebar.Sidebar.AddView(lvMenu, 20dip, 25dip, -1, -1)
'
''    lblInfo.Initialize("")
''    lblInfo.Text = "Click the button to open/close the sliding menu."
''    lblInfo.TextColor = Colors.Black
''    lblInfo.TextSize = 24
''    PanelWithSidebar.ContentPanel.AddView(lblInfo, 30dip, 30dip, 100%x - 60dip, 100%y - 60dip)
'
''    btnMenu.Initialize("")
''    btnMenu.SetBackgroundImage(LoadBitmap(File.DirAssets, "menu.png"))
'    FakeActionBar.AddView(Button1, 100%x - BarSize, 0, BarSize, BarSize)
'    PanelWithSidebar.SetOpenCloseButton(Button1)
End Sub
 
Last edited:
Cookies are required to use this site. You must accept them to continue using the site. Learn more…