我正在制作应用并面临这个问题:
在我在抽屉菜单中创建片段后,我的浮动按钮不再对任何东西做出反应。我在另一个论坛上问了这个问题,答案是我的Drawerlayout拦截了点击次数。我该如何解决这个问题?
<?xml version="1.0" encoding="utf-8"?>
<!-- Use DrawerLayout as root container for activity -->
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
xmlns:tools="http://schemas.android.com/tools"
tools:openDrawer="start"
android:clickable="false"
android:focusable="false">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="#00FFFFFF"
android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
android:elevation="4dp"/>
<!-- Layout to contain contents of main body of screen (drawer will slide over this) -->
<FrameLayout
android:id="@+id/fragment_container"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:clickable="false"
android:focusable="false"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="start">
<RelativeLayout
android:id="@+id/upper_section"
android:layout_width="match_parent"
android:layout_height="225dp"
android:background="@drawable/bg">
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="@+id/listview"
android:layout_alignParentBottom="true"
android:layout_gravity="end|bottom"
android:layout_marginBottom="22dp"
android:src="@drawable/ic_add"
app:fabSize="normal" />
</RelativeLayout>
</FrameLayout>
<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"
app:headerLayout="@layout/nav_header"
app:menu="@menu/drawer_view" />