1. Black Friday Sale - 50% off

    B4A Standard for $29 instead of $59!
    Buy Now
    Dismiss Notice

B4A Library MaterialDrawer V0.9 (Mike Penz)

Discussion in 'Additional libraries, classes and official updates' started by DonManfred, Dec 22, 2016.

  1. DonManfred

    DonManfred Expert Licensed User

    This thread is about the beta phase of my newest wrap. It is a wrap for this Github project: Material Drawer by Mike Penz

    At present the library is based on Version 5.8.1 of the Github project

    Mike Penz (Github) / DonManfred (wrapper)
    Version: 0.9 beta

    this contains the (most probably a bit chaotic) code for the example i build so far.
    So i just tried out how work this, and this and the code came up chaotic....
    I´m sure more examples will follow in future. Maybe made from one of the beatestes? (grins)

    this zip contains the folder "resource"
    copy this folder to your Project or maybe to your additional libraries folder.
    you need to adapt the #additionalres directive to match your folder

    MaterialDrawerFONTS1.zip and MaterialDrawerFONTS2.zip
    Copy all files to your additional libs folder

    Contains all needed AAR files. Copy them all to your additional libs folder

    The library depends on some other JARs from the google Maven repository.

    Post any questions regarding this librarywrap in this Thread please.

    Note that this library wrap is in development and subject to be changed before releasing the library.

    The example at present state shows all i have tried so far.
    Some features are not tested at all.
    Some features does not work as yet. The profile and everything about the profileheaderdraweritem for example.

    Known problems:
    - For me the Drawer will show behind the Actionbar. Due to this the layout in the top area is not placed correctly.
    I think it must be changed in the theme somehow but i´m sorr, i do not know how to fix this. Any help on this is highly appreciated!

    This library is Donationware. You can download the library, you can test the library. But if you want to USE the library in your App you need to Donate for it. I spend A LOT of time to build this library.

    Please click here to donate for my work to write the wrapper (You can donate any amount you want :))

    Attached Files:

    Last edited: Dec 22, 2016
  2. MarcoRome

    MarcoRome Expert Licensed User

  3. corwin42

    corwin42 Expert Licensed User

    I didn't took a closer look at the library and example for now.

    For my understanding it is not possible to show the drawer behind an ActionBar because the ActionBar is a system component and is always shown on top.
    You have to use a ToolBar which is part of the UI layout of the application and can be placed behind the drawer then.

    Does the drawer show behind the (transparent) status bar? This was a main problem I had when I created the NavigationDrawer object in the DesignSupport library.
    I got it only right when I created the layout by XML files and not by code.
  4. DonManfred

    DonManfred Expert Licensed User

    Ahh ok... Thank you. I´ll try to do the changes and test it

  5. alimanam3386

    alimanam3386 Active Member Licensed User


    First thank you for your great work:) ... when I compile the example I got this error : [API 22 Android 5.1.1]



    Panel size is unknown. Layout may not be loaded correctly.
    main_activity_create (java line: 
    android.content.res.Resources$NotFoundException: Resource 
    ID #0x0
        at android.content.res.Resources.getValue(Resources.java:
        at android.content.res.Resources.loadXmlResourceParser(Resources.java:
        at android.content.res.Resources.getLayout(Resources.java:
        at android.view.LayoutInflater.inflate(LayoutInflater.java:
        at com.mikepenz.materialdrawer.AccountHeaderBuilder.withAccountHeader(AccountHeaderBuilder.java:
        at com.mikepenz.materialdrawer.AccountHeaderBuilder.build(AccountHeaderBuilder.java:
        at de.donmanfred.AccountHeaderBuilderWrapper.build(AccountHeaderBuilderWrapper.java:
        at de.donmanfred.MaterialDrawer.main._activity_create(main.java:
        at java.lang.reflect.Method.invoke(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:
        at anywheresoftware.b4a.BA.raiseEvent2(BA.java:
        at de.donmanfred.MaterialDrawer.main.afterFirstLayout(main.java:
        at de.donmanfred.MaterialDrawer.main.access$
        at de.donmanfred.MaterialDrawer.main$WaitForLayout.run(main.java:
        at android.os.Handler.handleCallback(Handler.java:
        at android.os.Handler.dispatchMessage(Handler.java:
        at android.os.Looper.loop(Looper.java:
        at android.app.ActivityThread.main(ActivityThread.java:
        at java.lang.reflect.Method.invoke(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:
    android.content.res.Resources$NotFoundException: Resource 
    ID #0x0

    MAGAREY Member Licensed User

    I have the same problem, any suggestions?
  7. DonManfred

    DonManfred Expert Licensed User

    @alimanam3386 try to build a NEW project containing only the provided files. Not any older files.

    there are much more resourcefolder than i provided with the newest release.

    Only one Resourcefolder is needed.
    alimanam3386 likes this.
  8. alimanam3386

    alimanam3386 Active Member Licensed User

    Same problem !

    Attached Files:

  9. DonManfred

    DonManfred Expert Licensed User

    The resource folder does not have the expected content.
    Tr again with THIS resource-folder please

    Attached Files:

    alimanam3386 likes this.
  10. alimanam3386

    alimanam3386 Active Member Licensed User

    Now work fine thank you .... but the problem for " Does the drawer show behind the (transparent) status bar? " remaining.

    MAGAREY Member Licensed User

    It worked for me, placing this on the manifest:

    'This code will be applied to the manifest file during compilation.
    'You do not need to modify it in most cases.
    'See this link for for more information: http://www.basic4ppc.com/forum/showthread.php?p=78136
    <uses-sdk android:minSdkVersion=
    "7" android:targetSdkVersion="21"/>
    <supports-screens android:largeScreens=

    'End of default text.
    AddPermission(android.permission.INTERNET) ' Allows applications to open network sockets.
    SetApplicationAttribute(android:theme, "@style/MyAppTheme")

    CreateResource(values, theme.xml,
        <style name=
    "MyAppTheme" parent="@style/Theme.AppCompat">
            <item name=
            <item name=
            <item name=
               <item name=
            <item name=
            <item name=

    MAGAREY Member Licensed User

    @DonManfred how can i show de image in the header?, only shows the circle without the image
  13. DonManfred

    DonManfred Expert Licensed User

    i dont know, sorry
  14. DonManfred

    DonManfred Expert Licensed User

    It is working for me also. Great...

    Now we can try to find the right way of placing images or icons in the above header... As of now i´m not sure if this is the account header or another view of the drawer...
    alimanam3386 and MAGAREY like this.

    MAGAREY Member Licensed User

    i tried every views of the drawer, every account header and headers, and nothing, Any suggestions?
  16. jayel

    jayel Active Member Licensed User


    #Region  Project Attributes
    #ApplicationLabel: RoboNotification
    #VersionCode: 31
    'SupportedOrientations possible values: unspecified, landscape or portrait.
        #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
    '    #AdditionalRes: C:\ANDROID\SlidingMenu\library\res, com.jeremyfeinstein.slidingmenu.lib
        #AdditionalRes: C:\ANDROID\extra-libs\res\b4a_appcompat, android.support.v7.appcompat
    #AdditionalRes: C:\ANDROID\extra-libs\res\md-app\res
    #AdditionalRes: C:\ANDROID\extra-libs\res\md-lib\res
    #AdditionalJar: bcprov-jdk15on-154.jar

    #Extends: android.support.v7.app.AppCompatActivity
    #End Region

    Sub MakeMenu
    Dim pnlHdr As Panel
        pnlHdr.Color     = 
        pnlHdr.Tag       = 
    '    Dim MSP1 As MSProfile
    '    Dim PDB1 As BitmapDrawable : PDB1.Initialize(LoadBitmap(File.DirAssets,"profile2.jpg"))
    '    MSP1.withName("tds").withEmail("h@g.com").withIcon(PDB1)
    '    Dim MSP2 As MSProfile
    '    Dim PDB2 As BitmapDrawable : PDB2.Initialize(LoadBitmap(File.DirAssets,"profile3.jpg"))
    '    MSP2.withName("Neo").withEmail("neo@g.com").withIcon(PDB2)
    '    Dim Profiles(2) As MSProfile
    '    Profiles(0) = MSP1
    '    Profiles(1) = MSP2

    Dim p1 As MSIconicDrawable : p1.Initialize("ic_home_variant_black_24dp")  : p1.Color = 0xffff4081  '<---- this line is the error
    Dim s1 As MSIconicDrawable : s1.Initialize("ic_settings_black_24dp") : s1.Color = 0xffff4081
    Dim s2 As MSIconicDrawable : s2.Initialize("ic_application_black_24dp") : s2.Color = 0xffff4081
    Dim s3 As MSIconicDrawable : s3.Initialize("ic_logout_black_24dp") : s3.Color = 0xffff4081

        MDB.withHeader(pnlHdr, -
        MDB.AddPrimaryDrawerItem  (
    "Actions"  , p1.Drawable ,Null ,"99+" ,True,1"Acties domotica")
        MDB.AddSectionDrawerItem  (
    "Section"  ,True)
    "Settings" ,s1.Drawable ,Null ,""    ,True ,2)
    "About"     ,s2.Drawable ,Null ,""    ,True ,3)
        MDB.AddSectionDrawerItem  (
    "Section"  ,True)
    "Logout"     ,s3.Drawable ,Null ,""    ,True ,4)
        MD = MDB.Build
    End Sub
    I copied my png's to the folder C:\ANDROID\extra-libs\res\md-app\res
    But i get following error :
    Somebody any clue?

    Greets John
  17. DonManfred

    DonManfred Expert Licensed User

    This is not part of this lib... You are using msmaterialdrawer lib i guess
    Please create a post in the correct Thread.
  18. jayel

    jayel Active Member Licensed User

  19. mmucek

    mmucek Member Licensed User

    I installed MaterialDrawerEx1 example and it works great. Tried to add google maps and first of all i added
    #AdditionalJar: com.google.android.gms:play-services-maps
    and got this error:

    B4A version: 6.50
    Parsing code.    (
    Compiling code.    (
    file created in Objects folder.
    Compiling layouts code.    (
    Organizing libraries.    (
    Generating R 
    file.    (0.92s)
    Compiling generated Java code.    (
    Convert byte code - optimized dex.    Error
    trouble writing output: Too many field references: 
    67535max is 65536.
    You may 
    try using --multi-dex option.
    References by package:
    2 android.accounts
    26 android.app
    1 android.content
    29 android.content.pm
    10 android.content.res
    3 android.database
    46 android.graphics
    3 android.hardware
    1 android.location
    2 android.media
    1 android.media.browse
    2 android.net
    18 android.os
    3 android.print
    7 android.provider
    11 android.support.annotation
    6 android.support.compat
    6 android.support.coreui
    6 android.support.coreutils
    3267 android.support.design
    98 android.support.design.internal
    686 android.support.design.widget
    6 android.support.fragment
    159 android.support.graphics.drawable
    6 android.support.graphics.drawable.animated
    6 android.support.mediacompat
    3446 android.support.transition
    6 android.support.v4
    13 android.support.v4.accessibilityservice
    17 android.support.v4.animation
    865 android.support.v4.app
    112 android.support.v4.content
    1 android.support.v4.content.pm
    1 android.support.v4.content.res
    9 android.support.v4.graphics
    41 android.support.v4.graphics.drawable
    4 android.support.v4.hardware.display
    12 android.support.v4.hardware.fingerprint
    10 android.support.v4.internal.view
    350 android.support.v4.media
    300 android.support.v4.media.session
    10 android.support.v4.net
    19 android.support.v4.os
    63 android.support.v4.print
    9 android.support.v4.provider
    55 android.support.v4.text
    6 android.support.v4.text.util
    102 android.support.v4.util
    434 android.support.v4.view
    137 android.support.v4.view.accessibility
    8 android.support.v4.view.animation
    495 android.support.v4.widget
    394 android.support.v7.app
    3267 android.support.v7.appcompat
    8 android.support.v7.content.res
    18 android.support.v7.graphics.drawable
    3267 android.support.v7.recyclerview
    1 android.support.v7.text
    2 android.support.v7.transition
    124 android.support.v7.util
    77 android.support.v7.view
    248 android.support.v7.view.menu
    1379 android.support.v7.widget
    89 android.support.v7.widget.helper
    1 android.support.v7.widget.util
    5 android.text
    1 android.text.util
    2 android.transition
    14 android.util
    19 android.view
    8 android.view.accessibility
    1 android.view.inputmethod
    12 android.widget
    121 anywheresoftware.b4a
    81 anywheresoftware.b4a.keywords
    125 anywheresoftware.b4a.keywords.constants
    180 anywheresoftware.b4a.objects
    13 anywheresoftware.b4a.objects.collections
    15 anywheresoftware.b4a.objects.drawable
    3 anywheresoftware.b4a.objects.streams
    173 anywheresoftware.b4a.phone
    15 anywheresoftware.b4j.object
    3261 com.google.android.gms
    20 com.google.android.gms.actions
    15 com.google.android.gms.ads.identifier
    36 com.google.android.gms.auth.api.signin
    6 com.google.android.gms.auth.api.signin.internal
    3261 com.google.android.gms.base
    93 com.google.android.gms.common
    93 com.google.android.gms.common.api
    41 com.google.android.gms.common.data
    46 com.google.android.gms.common.images
    164 com.google.android.gms.common.internal
    1 com.google.android.gms.common.internal.safeparcel
    4 com.google.android.gms.common.server
    12 com.google.android.gms.common.server.converter
    33 com.google.android.gms.common.server.response
    50 com.google.android.gms.common.stats
    23 com.google.android.gms.common.util
    27 com.google.android.gms.dynamic
    2 com.google.android.gms.dynamite.descriptors.com.google.android.gms.flags
    16 com.google.android.gms.flags.impl
    6 com.google.android.gms.iid
    1366 com.google.android.gms.internal
    5 com.google.android.gms.location.places
    3423 com.google.android.gms.maps
    44 com.google.android.gms.maps.internal
    164 com.google.android.gms.maps.model
    10 com.google.android.gms.maps.model.internal
    18 com.google.android.gms.phenotype
    11 com.google.android.gms.playlog.internal
    6 com.google.android.gms.security
    26 com.google.android.gms.signin.internal
    48 com.google.android.gms.tasks
    1581 com.mikepenz
    3304 com.mikepenz.fastadapter
    12 com.mikepenz.fastadapter.adapters
    11 com.mikepenz.fastadapter.helpers
    10 com.mikepenz.fastadapter.items
    1 com.mikepenz.fastadapter.utils
    29 com.mikepenz.fastadapter_extensions
    4 com.mikepenz.fastadapter_extensions.dialog
    6 com.mikepenz.fastadapter_extensions.drag
    27 com.mikepenz.fastadapter_extensions.items
    34 com.mikepenz.fastadapter_extensions.scroll
    8 com.mikepenz.fastadapter_extensions.swipe
    2 com.mikepenz.fastadapter_extensions.utilities
    3948 com.mikepenz.fontawesome_typeface_library
    801 com.mikepenz.google_material_typeface_library
    3315 com.mikepenz.iconics
    18 com.mikepenz.iconics.context
    3267 com.mikepenz.iconics.core
    690 com.mikepenz.iconics.typeface
    15 com.mikepenz.iconics.utils
    8 com.mikepenz.iconics.view
    3267 com.mikepenz.library_extensions
    293 com.mikepenz.materialdrawer
    10 com.mikepenz.materialdrawer.holder
    11 com.mikepenz.materialdrawer.icons
    181 com.mikepenz.materialdrawer.model
    1 com.mikepenz.materialdrawer.model.utils
    18 com.mikepenz.materialdrawer.util
    21 com.mikepenz.materialdrawer.view
    3288 com.mikepenz.materialize
    339 com.mikepenz.materialize.color
    2 com.mikepenz.materialize.drawable
    11 com.mikepenz.materialize.holder
    5 com.mikepenz.materialize.util
    16 com.mikepenz.materialize.view
    3319 de.amberhome.objects
    3331 de.amberhome.objects.appcompat
    62 de.donmanfred
    3306 de.donmanfred.MaterialDrawer
    13 java.lang
    11 java.lang.annotation
    1 java.nio
    6 java.util
    2 java.util.concurrent
  20. Erel

    Erel Administrator Staff Member Licensed User

    It happens when you reference many libraries with internal resources.

    You can solve it by editing the AndroidManifest.xml file that is in the AAR projects (use 7zip to open them) and change the package name to be the same as other packages.

    For example find the one with package name de.amberhome.objects (one of corwin42's libraries) and change it to de.amberhome.objects.appcompat.
    Last edited: Jan 24, 2017
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice