Hi All,
Has anyone else had an issue on tall drawers that they do not open at the top. I have a drawer menu that extends off page and when the drawer opens it has been slid down. Is there a way to use a java object to get the draw to always open at the top?
Hi there guys, i seem to have issues in showing the msicondrawable? im trying to run the example in MSMaterialDrawer example but all i get is this. No icon is shown? what could be the issue? Also is it possible if i just use a typeface for the drawable instead of using msiconic?
I already copied them under Files/fonts folders. The filename were fontawesome-webfont-4.3.0.ttf and google_material_design.ttf
Q1. Where can when can I download this library?
A1. See Post 4.
Q2. Can you add toggle/switch buttons in the drawer?
A2. Yes, this is not implemented. Convince me to do it with some incentive.
Q3. The github source has a lot more features, has been updated, when will you update the library?
A3. I wont update it unless there is a good reason to.
Q4. Can I have the source?
A4. Send me a PM and I will need to link you to the GitLab Repo.
Q5. I see errors like this:
B4X:
C:\Users\Giuseppe\Desktop\Extra\lib\res\values-v21\styles.xml:8: error: Error: No resource found that matches the given name: attr 'android:colorAccent'.
A5. Make sure in B4A > Configure paths > android.jar is pointing towards the android-22 or later jar.
Make sure you have the appcompat support libraries referenced (by copying to AdditionalLibs or by using AdditionalJar). (from: C:\android-sdk\extras\android\support\v7\appcompat\libs)
Q6. I initialized the MSIconicDrawable, but I dont see any drawable or icons when i run the app?
A6. Make sure you actually copied and added the font files in the Files directory of the project. These must be under Files/fonts/ directory with the fonts being in lowecase.
List of Files, Examples and Demos Demos and Examples:
Main demo
Theming
Using with AppCompat/Toolbar
Custom Header
Hi.
When I run the "MSMaterialDrawer/B4A Samples/AppCompatDrawer" example the following runtime error occurs:
** Activity (main) Create, isFirst = true **
main_activity_create (java line: 327)
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:166)
at anywheresoftware.b4a.objects.ActivityWrapper.LoadLayout(ActivityWrapper.java:208)
at com.maximussoft.appcompatdrawer.main._activity_create(main.java:327)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)
at com.maximussoft.appcompatdrawer.main.afterFirstLayout(main.java:102)
at com.maximussoft.appcompatdrawer.main.access$000(main.java:17)
at com.maximussoft.appcompatdrawer.main$WaitForLayout.run(main.java:80)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.objects.CustomViewWrapper.AfterDesignerScript(CustomViewWrapper.java:54)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:158)
... 14 more
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lde/amberhome/objects/appcompat/R$style;
at de.amberhome.objects.appcompat.ACToolbarLightWrapper.innerInitialize(ACToolbarLightWrapper.java:26)
at anywheresoftware.b4a.objects.ViewWrapper.Initialize(ViewWrapper.java:65)
at de.amberhome.objects.appcompat.ACToolBarWrapper.Initialize(ACToolBarWrapper.java:45)
at de.amberhome.objects.appcompat.ACToolBarWrapper._initialize(ACToolBarWrapper.java:77)
... 17 more
Caused by: java.lang.ClassNotFoundException: Didn't find class "de.amberhome.objects.appcompat.R$style" on path: DexPathList[[zip file "/data/app/com.maximussoft.appcompatdrawer-2/base.apk"],nativeLibraryDirectories=[/data/app/com.maximussoft.appcompatdrawer-2/lib/x86, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
... 21 more
Suppressed: java.lang.ClassNotFoundException: de.amberhome.objects.appcompat.R$style
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 22 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
Hello @thedesolatesoul, has identified a problem with the scroll include Drawer, it remains in the bottom of the layout a white strip, which cuts the layout.
Which is not the problem and tried to fix it but I have not succeeded, not if it's just me, leave attached the test and been doing.
Hello @thedesolatesoul, has identified a problem with the scroll include Drawer, it remains in the bottom of the layout a white strip, which cuts the layout.
Which is not the problem and tried to fix it but I have not succeeded, not if it's just me, leave attached the test and been doing.
This is a port of library from here: https://github.com/mikepenz/MaterialDrawer
Its an amazing library by Mike Penz and it simplifies most of the Navigation Drawer setup and theming.
Library Setup
1. Copy the MSMaterialDrawer.jar and xml files to your AdditionalLibs folder.
2. This is also dependent on AppCompat v7 Support library, so copy that to AdditionalLibs or use AdditionalJar.
3. Make sure your android.jar in B4A > ConfigurePaths is set to point to android-22 at least.
4. There are 3 resource zip files. Unzip them in your desired area, and use #AdditionalRes to point to them.
5. If you want to use your own theme in styles.xml, you can also point to that with #AdditionalRes.
6. Depending on how you want to use it, (for e.g. with AppCompat Toolbar) you can set #Extends: with extending to ActionbarActivity. You can also specify the theme in the manifest.
7. If you want to use Iconics (Icon fonts), you also need to copy the font files in your files directory in a folder called fonts/ (lowercase).
Library Usage
Creating a simple drawer
Making a simple drawer is amazingly easy. There are two drawer objects:
- MaterialDrawerBuilder: Used to set all the params and build the drawer
- MaterialDrawer: This is the result when you build the drawer from the MaterialDrawerBuilder.
There are many other options like actionbar/toolbar/statusbar options. Customising the header/footer.
The theming and color can only be changed via styles.xml.
Events
The drawer can raise the following events:
- Closed
- Opened
- ItemClick
- ItemLongClick
In order to know which item was clicked/longclicked you need to assign them an 'identifier' when adding to the drawer, so you can check it later in the click event.
Theming the Drawer
The main way to customize the looks of the drawer is via a theme.
The theme is applied on the activity, and the drawer inherits its properties from that theme.
The library already comes with the following built-in themes that you can set. These built-in themes all depend on the AppCompat library and resources, so make sure you have those linked and copied as well.
To further theme, you can either inherit from one of these themes and override the colors.
You can also create your own custom style, but be sure to add the style attributes requires by the Material Drawer. An example is available for this.
Basically it allows you to use an Icon Font as a drawable.
What is the advantage of this?
- You cant tint/color the drawable by code which is insanely cool.
- They scale well, and you can set the size according to your needs.
- The ttf files are generally small enough, so you can pack a large number of icons into a manageable file.
Currently there is support for font-awesome and google-material-icons fonts. Others can be added (but missing some features).
How to use: You must copy the font ttf file in your projects Files/fonts/<fontname>
Here is a link to the fonts used in the project. Download fonts
Then in code:
B4X:
Dim s2 As MSIconicDrawable
s2.Initialize("gmd_help") 'Load a google material design icon
s2.Color = 0xffff4081 'Change the color of icon
Dim s3 As MSIconicDrawable
s3.Initialize("faw_google_wallet") 'Load a font awesome icon
s3.Color = 0xffff4081 'Change the icon color
'List all icons available in a font
Log(s2.ListDrawables("gmd")) 'List Google material design icons
Log(s2.ListDrawables("faw")) 'List Font awesome icons
'Use the Drawable as
button.Background = s2.Drawable
Sub MD_ItemClick(Position As Int, Identifier As Int)
Log("Clicked:" & Position & " Iden:" & Identifier)
ToastMessageShow("Clicked:" & Position & " Iden:" & Identifier, False)
End Sub
Thedesolatesoul, test your apk. Very cool!
But not understand your step to create the MSMaterialDrawer.
I extracted the packet https://github.com/mikepenz/MaterialDrawer, but I dont know how to proceeded.
I'm sorry you can do one video tutorial.
Thanks
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.