MSMaterialDrawer

asales

Expert
Licensed User
Longtime User
Hello again, @thedesolatesoul .

I have a problem with this library in my new app (in other apps the library works fine).

It shows an blank line in the footer (see image1).
When I open the drawer the blank line disappears.

My code is in attached.

I tried, but I don't know what's happening and how to solve.

Thanks in advance for any tip.

Image1.jpg
 

Attachments

  • msdrawer2.zip
    8.1 KB · Views: 197

thedesolatesoul

Expert
Licensed User
Longtime User
Hello again, @thedesolatesoul .

I have a problem with this library in my new app (in other apps the library works fine).

It shows an blank line in the footer (see image1).
When I open the drawer the blank line disappears.

My code is in attached.

I tried, but I don't know what's happening and how to solve.

Thanks in advance for any tip.

View attachment 35445
i dont see a blank line. what device and os are you testing on?
 

asales

Expert
Licensed User
Longtime User
i dont see a blank line. what device and os are you testing on?

Moto G2 and Sony Xperia E1.
It shows a blank line in the footer of screen.

I tested now in tablet Galaxy Note 8 and it don't shows the blank line.

Thanks for your answers. I will continue the tests.
 

Jerez

Active Member
Licensed User
Longtime User
Hi,
I'm testing your demo app: MSMaterialDrawerSample.zip


I've this libraries on my "Library" folder:
android-support-v4
android-support-v7-appcompat
android-support-v7-mediarouter

Also i'm using the android-22.

And...

I've changed the lines to:

B4X:
'#AdditionalRes: H:\Eclipse\adt-bundle-windows-x86_64\sdk\extras\android\support\v7\appcompat\res, android.support.v7.appcompat
    '#AdditionalRes: H:\MyProjects\Github_masters\MaterialDrawer-master\MaterialDrawer-master\library\src\main\res
    '#AdditionalRes: H:\MyProjects\Github_masters\MaterialDrawer-master\MaterialDrawer-master\app\src\main\res
    #AdditionalRes: C:\Xamarin\Android-SDK\extras\android\support\v7\appcompat\res, android.support.v7.appcompat
    #AdditionalRes: C:\Xamarin\Android-SDK\Drawer\AdditionalResources\md-lib\res
    #AdditionalRes: C:\Xamarin\Android-SDK\Drawer\AdditionalResources\md-app\res

And compile without problems!, but when i click the button to open drawer i get an error on this line:

MD = MDB.Build


B4X:
** Activity (main) Pause, UserClosed = false **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (actheader) Create, isFirst = true **
actheader_activity_create (B4A line: 64)
MD = MDB.Build

android.view.InflateException: Binary XML file line #12: Error inflating class com.mikepenz.materialdrawer.view.ScrimInsetsFrameLayout
    at android.view.LayoutInflater.createView(LayoutInflater.java:620)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
    at com.mikepenz.materialdrawer.Drawer.withDrawerLayout(Drawer.java:246)
    at com.mikepenz.materialdrawer.Drawer.build(Drawer.java:965)
    at com.maximussoft.msmaterialdrawer.MSMaterialDrawerBuilder.Build(MSMaterialDrawerBuilder.java:112)
    at com.maximussoft.materialdrawer.actheader._activity_create(actheader.java:472)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:187)
    at com.maximussoft.materialdrawer.actheader.afterFirstLayout(actheader.java:100)
    at com.maximussoft.materialdrawer.actheader.access$100(actheader.java:17)
    at com.maximussoft.materialdrawer.actheader$WaitForLayout.run(actheader.java:78)
    at android.os.Handler.handleCallback(Handler.java:733)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:136)
    at android.app.ActivityThread.main(ActivityThread.java:5021)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:827)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:643)
    at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Constructor.constructNative(Native Method)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at android.view.LayoutInflater.createView(LayoutInflater.java:594)
    ... 23 more
Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x5/d=0x1 a=1}
    at android.content.res.Resources.loadDrawable(Resources.java:2068)
    at android.content.res.TypedArray.getDrawable(TypedArray.java:602)
    at com.mikepenz.materialdrawer.view.ScrimInsetsFrameLayout.init(ScrimInsetsFrameLayout.java:66)
    at com.mikepenz.materialdrawer.view.ScrimInsetsFrameLayout.<init>(ScrimInsetsFrameLayout.java:52)
    ... 26 more
** Activity (main) Resume **

what is wrong with my setup? looks like a resource is missing...

BIG THANKS!
 
Last edited:

Jerez

Active Member
Licensed User
Longtime User
Yeah! was the theme... i changed to:

B4X:
SetApplicationAttribute(android:theme, "@android:style/Theme.Holo.Light.DarkActionBar")

And it work! thanks!

B4X:
'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.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="14"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'SetApplicationAttribute(android:theme, "@android:style/Theme.AppCompat")
'SetApplicationAttribute(android:theme, "@style/Theme.AppCompat")
SetApplicationAttribute(android:theme, "@style/MaterialDrawerTheme.ActionBar")
'End of default text.
SetActivityAttribute(actLight, android:theme, "@style/MaterialDrawerTheme.Light")
 

Fusseldieb

Active Member
Licensed User
Longtime User
hi guys, please can someone help me, i want to change the icon color when selected, and when the user select another item, the icon color back to the default color. something like youtube app and many other google apps.
thanks
 

Jerez

Active Member
Licensed User
Longtime User
@thedesolatesoul: Please adviseme here:
one of the most awesome features of your library are the icon library. But, i want to share same UI in Android and iPhone. So, i want to load my custom icons on this line:

B4X:
MDB.AddPrimaryDrawerItem  ("Notificaciones"  , p1.Drawable ,Null ,"99+" ,True,1, "Shows the weather")

This line make my app crash
B4X:
MDB.AddPrimaryDrawerItem  ("Notifications"  , LoadBitmap(File.DirAssets,"app.png") ,Null ,"99+" ,True,1, "Shows the weather")

Can you help me?

Thanks for your time!
 

Jerez

Active Member
Licensed User
Longtime User
Use a drawable not a bitmap.
I know, but i don't know how to load a file from my assets as drawable... i always use LoadBitmap :s

Edit:

I found the solution:

B4X:
Dim icon As BitmapDrawable
icon.Initialize(LoadBitmap(File.DirAssets,"star.png"))

...
MDB.AddPrimaryDrawerItem  ("Notificaciones"  , icon ,Null ,"99+" ,True,1, "Shows the weather")

Thanks
 
Last edited:

Fusseldieb

Active Member
Licensed User
Longtime User
I know, but i don't know how to load a file from my assets as drawable... i always use LoadBitmap :s

Edit:

I found the solution:

B4X:
Dim icon As BitmapDrawable
icon.Initialize(LoadBitmap(File.DirAssets,"star.png"))

...
MDB.AddPrimaryDrawerItem  ("Notificaciones"  , icon ,Null ,"99+" ,True,1, "Shows the weather")

Thanks
there is any way to change that icon image when click in another icon or button ?
thanks
 

ArminKH

Well-Known Member
how is possible to change items font and gravity?
for example i want to make a side bar for right to left writing language
i want to change gravity of items(icon and title) to right
is this possible?
 
Top