A
A
AndreyOstapov2019-01-14 20:27:43
Android
AndreyOstapov, 2019-01-14 20:27:43

How to implement ActionBarDrawerToggle listener for second NavigationView?

Please tell me how to implement the ActionBarDrawerToggle listener for a specific NavigationView. The DrawerLayout has two NavigationViews at the beginning and at the end.

<android.support.design.widget.NavigationView
        android:id="@+id/navigation"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        app:headerLayout="@layout/side_menu_header"
        app:menu="@menu/side_menu"/>

   <android.support.design.widget.NavigationView
        android:id="@+id/navigation2"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="end"
        app:headerLayout="@layout/side_menu_header"
        app:menu="@menu/side_menu"/>

Next I add the listener:
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar,
                R.string.open_drawer_state, R.string.close_drawer_state);
        drawer.addDrawerListener(toggle);
        toggle.syncState();

The problem is that when clicked, the left NavigationView opens. Is it possible to set toggle to open a second NavigationView, the one on the right? Thanks in advance for your help.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question