B4A Library [B4X] [XUI] AS Draggable Bottom Card

Alexander Stolte

Licensed User
This is my 2k'th post on this Forum and i want to share a nice library with you i made some months ago.
It was not easy to create this library, it took many hours of testing and programming to make the user experience as good as possible.

If you want to support me, then you can do this here. Thanks :)

This lib. is only for B4I and B4A.
B4J is not tested and i currently dont want to support it
B4J is now supported

  • cross-platform compatible
  • easy to use
  • use your own header and body layout
  • 2 states - half expanded and full expanded
  • Events
  • and more...
Some design inspiration:

bottom card.PNG


Author: Alexander Stolte
Version: 1.02

  • ASDraggableBottomCard
    • Events:
      • Close
      • Closed
      • Open
      • Opened
      • VisibleBodyHeightChanged (height As Double)
    • Fields:
      • g_hide_duration As Int
      • g_show_duration As Int
    • Functions:
      • Base_Resize (Width As Double, Height As Double) As String
      • BodyPanel As B4XView
      • Class_Globals As String
      • Create (Parent As B4XView, first_height As Float, second_height As Float, header_height As Float, width As Float, orientation As Int) As String
        Base type must be Object
      • ExpandFull As String
      • ExpandHalf As String
      • getCardBase As B4XView
      • getDarkPanelAlpha As Int
      • getFirstHeight As Float
      • getHeaderHeight As Float
        gets the header height
      • getIsOpen As Boolean
      • getSecondHeight As Float
      • HeaderPanel As B4XView
      • Hide (ignore_event As Boolean)
      • Initialize (Callback As Object, EventName As String) As String
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • Orientation_LEFT As Int
      • Orientation_MIDDLE As Int
      • Orientation_RIGHT As Int
      • setCornerRadius_Header (radius As Float) As String
        sets the corner radius of the header
      • setDarkPanelAlpha (alpha As Int) As String
      • Show (ignore_event As Boolean) As String
    • Properties:
      • CardBase As B4XView [read only]
      • CornerRadius_Header
        sets the corner radius of the header
      • DarkPanelAlpha As Int
      • FirstHeight As Float [read only]
      • HeaderHeight As Float [read only]
        gets the header height
      • IsOpen As Boolean [read only]
      • SecondHeight As Float [read only]
  • 1.00
    • Release
  • 1.01
    • Various bug fixes and improvements
    • The menu no longer closes when the last swipe went up, so it is now possible for the user to cancel a full close
  • 1.02
    • Add CornerRadius_Header - sets the CornerRadius of the header
      • dont use asdbc_main.HeaderPanel.Height if your set the corner radius, the returning height is not the display height
      • use HeaderHeight instead
    • Add HeaderHeight - gets the displayed header height
    • Supports now B4J
Have Fun :)


Last edited:


Active Member
Licensed User
Great Library!

Is is possible to have two panels, like some android tablet versions have, a tab on the right other on the left ?

This way I can have 2 context of stuff in each panel.

Thanks !


Licensed User
This class works great on Android. Thank you Alexander!

Currently I’m struggling with it B4i. I added a reference to GestureRecognizer found here. Now it compiles without any error. But the menu does not show up at all. Probably I’m doing some wrong when initializing the card like this:

Private Sub Application_Start (Nav As NavigationController)
    NavControl = Nav
    asdbc_main.Create(MainPage.RootPanel,MainPage.RootPanel.Height/2,MainPage.RootPanel.Height - 60dip,50dip,MainPage.RootPanel.Width - 20dip,asdbc_main.Orientation_MIDDLE)
End Sub
I provided a simple B4i Example that can be used to test this issue. Any help is appreciated!

Thanks, Thomas



Active Member
Licensed User
Hi. When i only include the class file and compile the app it say:

B4A Versión: 10.2
Java Versión: 8
Parseando código. (0.68s)
Building folders structure. (0.63s)
Compilando código. (1.20s)
Compilado códigos de diseños. (0.06s)
Organizando librerías. (0.04s)
(AndroidX SDK)
Generando el fichero R. (1.72s)
Compilando el código del motor de depuración. (5.71s)
Compilando el código Java generado. Error
El nombre del archivo o la extensión es demasiado largo

"The archive name or the extension is a lot of large"

However in your example it works ok.

If i remove the class file from the project and compile again then compilation is ok.

EDIT: I just passed from Java 8 to java 11 (as recommended in the B4A installation) and I no longer have that error when compiling the app.

EDIT2: Again, even with Java 11, the class name or its extension is too long. The issue is only when i compile it in Debug mode. It works in Release mode. If i compile it in Release mode and then i compile again in Debug mode then it doesn't give me the error...

Last edited:

Alexander Stolte

Licensed User

  • Add CornerRadius_Header - sets the CornerRadius of the header
    • dont use asdbc_main.HeaderPanel.Height if your set the corner radius, the returning height is not the display height
    • use HeaderHeight instead
  • Add HeaderHeight - gets the displayed header height
  • Supports now B4J
  • New B4XPages Example
You can now make the header corner rounded, without doing it with tricks in the designer

B4J is now supported

Alexander Stolte

Licensed User
yeah, i forgot that we need in B4I this before we add the menu: Wait For B4XPage_Resize (Width As Int, Height As Int)
I updated the example project.
And do not forget, to uncheck "HandleResizeEvent" and remove the AutoScale in the designer on B4I, B4J and B4A.