浮动操作按钮不重叠底部工作表

时间:2017-05-03 12:46:10

标签: android android-layout

我遇到的问题是我的浮动操作按钮没有在协调器布局中的底部工作表上重叠。我怎么解决这个问题?底层布局是Map Fragment。

The layout looks like this

XML看起来如下:

onepagecheckout

1 个答案:

答案 0 :(得分:1)

尝试在LinearLayout设置正marginTop并从FAB中删除负值:

<?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.FloatingActionButton
        android:id="@+id/floatingActionButtonAdd"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="end|top"
        android:src="@drawable/ic_add_white_48dp"
        app:backgroundTint="@color/colorPrimary"
        app:borderWidth="0dp"
        app:elevation="4dp"
        app:fabSize="normal"/>

    <LinearLayout

        android:layout_marginTop="32dp"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:id="@+id/linear_layout_bottom_sheet">

        <!-- include bottom sheet -->
        <include layout="@layout/bottom_sheet_peek" />

        <!-- include main content -->
        <include layout="@layout/bottom_sheet_content" />

    </LinearLayout>
</android.support.design.widget.CoordinatorLayout>