简体   繁体   中英

Navigation drawer with ListView instead menu

I made a custom Navigation drawer in the active with dynamic ListView instead of the menu. The Navigation drawer itself works fine, but all the View (buttons \\ checkboxes, etc.) do not work on the OnClickListener. before that everything worked fine and in other activations everything works fine.

<?xml version="1.0" encoding="utf-8"?>


<android.support.design.widget.CoordinatorLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"><android.support.design.widget.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/AppTheme.AppBarOverlay">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="56dp"
        android:layout_marginTop="16dp"
        app:popupTheme="@style/AppTheme.PopupOverlay" />

</android.support.design.widget.AppBarLayout>

<include layout="@layout/content_fz_main" />

<android.support.v4.widget.DrawerLayout
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginTop="54dp"
    android:fitsSystemWindows="true"
    tools:openDrawer="start">


    <android.support.design.widget.NavigationView
        android:id="@+id/nav_view"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:fitsSystemWindows="true">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">

            <include layout="@layout/nav_header_fz_main" />

            <ImageView
                android:id="@+id/nwBackButton"
                android:layout_width="50dp"
                android:layout_height="34dp"
                android:layout_margin="8dp"
                android:visibility="gone"
                app:srcCompat="@drawable/ic_backspace" />

            <ListView
                android:id="@+id/left_drawer"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_gravity="start"
                android:choiceMode="singleChoice"
                android:divider="@android:color/transparent"
                android:dividerHeight="0dp" />
        </LinearLayout>
    </android.support.design.widget.NavigationView>
</android.support.v4.widget.DrawerLayout></android.support.design.widget.CoordinatorLayout>

In the active via Butter Knife initialization and with the Navigation drawer does not work anymore

in onCreate:

setSupportActionBar(toolbar);
toolbar.setTitle(getResources().getString(R.string.app_name));
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
        this, drawer, toolbar,
        R.string.navigation_drawer_open,
        R.string.navigation_drawer_close);
drawer.addDrawerListener(toggle);
toggle.syncState();

sorry for my english. someone can help me?

我发现问题只是添加到内容布局

        content.bringToFront();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM