0

所以我有这个活动布局:重叠Android的意见和处理点击

<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:id="@+id/drawer_layout" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:fitsSystemWindows="true" 
    tools:openDrawer="start"> 
    <android.support.design.widget.CoordinatorLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:fitsSystemWindows="true"> 
      <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="?attr/actionBarSize" 
        android:background="?attr/colorPrimary" 
        app:popupTheme="@style/AppTheme.PopupOverlay" /> 
      </android.support.design.widget.AppBarLayout> 
    </android.support.design.widget.CoordinatorLayout> 

    <FrameLayout 
     android:id="@+id/mainContent" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"/> 

    <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_main" 
     app:menu="@menu/activity_main_drawer" /> 

</android.support.v4.widget.DrawerLayout> 

mainContent是其中的片段会夸大其观点。在我的特殊情况下,膨胀的片段将具有cardview的回收视图。

的问题是,因为它是,布局看起来我希望它,就像这样:

enter image description here

但抽屉式导航栏图标是不可点击。如果我用的FrameLayout交换协调布局,出现这种情况:

enter image description here

和导航抽屉变成可点击的,但图标板缺。我知道我在这里错过了一些东西,我只是无法弄清楚。 我试图把这两个里面的framelayout,但相同的输出。

+0

能否请您添加活动的Java代码? – Mohsen

回答

0

该按钮不应该存在。那不是MaterialDesign指南所说的。

您可以使用FloatingActionaButton与风格类似如下: https://github.com/xuyisheng/DesignSupportLibraryDemo

或者用它象下面这样:

<android.support.design.widget.FloatingActionButton 
    android:onClick="checkin" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_margin="@dimen/fab_margin" 
    android:clickable="true" 
    android:src="@drawable/ic_discuss" 
    app:layout_anchor="@id/appbar" 
    app:layout_anchorGravity="bottom|right|end"/> 

https://github.com/xuyisheng/DesignSupportLibraryDemo/blob/master/app/src/main/res/layout/activity_detail.xml

以及有关FrameLayout,因为我看到,你有CoordinatorLayout与那FrameLayout我认为FrameLayout我们承认像NavigationDrawer

尝试的地方使用它else.or使用下面的回答: https://stackoverflow.com/a/32035783/4409113