NavigationView监听器无效

NavigationView没放在布局的最后面设置监听器无效,还有这样的事。

下面是的布局设置监听器ok

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout 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:fitsSystemWindows="true"
    android:id="@+id/drawer"
    >
    <android.support.design.widget.CoordinatorLayout
        android:fitsSystemWindows="true"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <android.support.design.widget.CollapsingToolbarLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:fitsSystemWindows="true">
            <ImageView
                android:fitsSystemWindows="true"
                android:scaleType="centerCrop"
                android:id="@+id/listpic"
                android:background="@android:color/transparent"
                android:layout_width="match_parent"
                android:layout_height="match_parent" />
        </android.support.design.widget.CollapsingToolbarLayout>
        <LinearLayout
            android:orientation="vertical"
            android:layout_width="match_parent"
            android:layout_height="match_parent">
            <RelativeLayout
                android:layout_gravity="center"
                android:layout_width="match_parent"
                android:layout_height="wrap_content">
                <TextView
                    android:layout_alignParentRight="true"
                    android:textSize="20sp"
                    android:gravity="center"
                    android:text="音乐列表"
                    android:layout_width="match_parent"
                    android:layout_height="40dp" />
                <Button
                    android:padding="5dp"
                    android:id="@+id/menu_button"
                    android:layout_marginTop="10dp"
                    android:layout_marginLeft="10dp"
                    android:layout_marginRight="10dp"
                    android:background="@mipmap/menu_button"
                    android:gravity="center"
                    android:layout_width="30dp"
                    android:layout_alignParentLeft="true"
                    android:layout_height="30dp" />
            </RelativeLayout>

            <ListView
                android:id="@+id/music_listview"
                android:layout_gravity="left"
                android:layout_width="match_parent"
                android:layout_height="match_parent">
            </ListView>
        </LinearLayout>
    </android.support.design.widget.CoordinatorLayout>

    <LinearLayout
        android:layout_margin="5dp"
        android:padding="5dp"
        android:gravity="center"
        android:layout_height="wrap_content"
        android:layout_width="match_parent">
    <Button
        android:background="@drawable/solid"
        android:gravity="center"
        android:layout_width="wrap_content"
        android:id="@+id/saomiao"
        android:text="扫描音乐"
        android:layout_gravity="bottom"
        android:layout_height="wrap_content" />
    </LinearLayout>
    <android.support.design.widget.NavigationView

        android:fitsSystemWindows="true"

        android:id="@+id/nav_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        app:menu="@menu/nav_menu"
        app:headerLayout="@layout/nav_header">
    </android.support.design.widget.NavigationView>
</android.support.v4.widget.DrawerLayout>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值