B4A Library AHNavigationDrawer - Native Google Navigation Drawer

Alisson

Active Member
Licensed User
Corwin42, my test result one fail.
I receive the message: "The Navigation Drawer stopped".
What can I do?
 

corwin42

Expert
Licensed User
Longtime User
I have one error:

View attachment 40427
How can solve the problem?

It seems that the nineoldandroids library is added multiple times. What Libraries do you use in your project and/or do you use #AdditionalJar property to add it manually?
 

shashkiranr

Active Member
Licensed User
Longtime User
Hi All,

After using the material menu along with appcompact actionbar and navigation panel,It is occupying more space in the actionbar. i have added a edittext to the actionbar to show the difference.

Before adding the material menu to upindicator,



After adding the material menu to upindicator.



Update : used the gravity property and fixed it.

Best,
SK
 
Last edited:

infow

Member
Licensed User
Longtime User
Getting this running, trying to open AD:
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Resume **
An error occurred:
(Line: 0) End Sub
java.lang.Exception: Sub drawer_drawerslide signature does not match expected signature.
public static anywheresoftware.b4a.pc.RemoteObject actn.drwr.actiondrawer_subs_0._drawer_drawerslide(anywheresoftware.b4a.pc.RemoteObject,anywheresoftware.b4a.pc.RemoteObject) throws java.lang.Exception
 

uniplan

Active Member
Licensed User
Longtime User
I would like to know if I can open the SecondaryDrawer with a command (for example with a dedicated button) and not just by sliding the right of the screen.
 

corwin42

Expert
Licensed User
Longtime User
I would like to know if I can open the SecondaryDrawer with a command (for example with a dedicated button) and not just by sliding the right of the screen.
B4X:
NavDrawer.OpenDrawer2(NavDrawer.GRAVITY_RIGHT)
 

Dave O

Well-Known Member
Licensed User
Longtime User
Hi @corwin42 , thanks for this control! I'm trying it in my next app.

It did take me a few tries to figure out that I should:
- initialize the nav drawer to the activity directly
- load my layout from the drawer.contentPanel, not the activity

Additional question: On long clicks on a view, I show a tooltip toast message. The code that calculates the tooltip's position goes up the view hierarchy to accumulate the left and top offsets. However, my code can't yet handle the nav drawer (which it encounters when climbing up from the view to the content panel to the drawer).

It crashes when the code below encounters a "drawerLayout":

B4X:
Sub getScreenPosition(viewArg As View) As Int()
   Dim position(2), parentPosition(2) As Int
   If viewArg.parent Is ScrollView Then
     'the scrollview's panel has no layout, so ignore
     Dim sv As ScrollView = viewArg.Parent
     position(0) = sv.left
     position(1) = sv.Top - sv.ScrollPosition
     Return position
   else If viewArg.parent Is AHNavigationDrawer Then     '<< this never gets triggered, so it climbs one more to the activity
     position(0) = 0
     position(1) = 0
     Return position
   else if viewArg.parent = getCurrentActivity Then
     Log("viewArg = " & viewArg)
     Log("viewArg.parent = " & viewArg.parent)
     position(0) = viewArg.Left                                '<< crashes here (because drawer has no Left property?)
     position(1) = viewArg.Top
     Return position
   Else
     parentPosition = getScreenPosition(viewArg.parent)
     position(0) = viewArg.Left + parentPosition(0)
     position(1) = viewArg.top + parentPosition(1)
     Return position
   End If
End Sub

Any tips on how to handle the nav drawer in this situation?

Thanks again!
 

Stern0m1

Member
Licensed User
I having trouble getting the android-support-v4.jar file. Can anyone send me a direct link?

by me in C:\Android\extras\android\m2repository\com\android\support\support-v4\22.1.0
I have support-v4-22.1.0-sources. I tried puting that file in the extra libraries folder but im still getting the error asking for the android-support-v4.jar file. I tried renaming it also.


Thanks
 

corwin42

Expert
Licensed User
Longtime User

You don't need the android-support-v4.jar file anymore.

Just add:
B4X:
#AdditionalJar: com.android.support:support-v4
and it should work. You will need B4A 6+
 

MichalK73

Well-Known Member
Licensed User
Longtime User
yes but there was a problem with old B4A versions. Be sure to use B4A 4.00 or above and use the Activity_ActionBarHomeClick event.

I have
B4X:
Sub Activity_ActionBarHomeClick
    Log("NavDrawer open")
    NavDrawer.OpenDrawer
End Sub

Does not work. In general it does not execute code. How to solve it?
 

corwin42

Expert
Licensed User
Longtime User

As I wrote in another thread:

Call ToolBar.InitMenuListener
and use the ToolBar_NavigationItemClick event.
 

MichalK73

Well-Known Member
Licensed User
Longtime User
Is it possible use of two NavDrawer the left and right? I would like in some moments of the program that was NavDraver on the right side of the other options. It is possible?
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…