将新的浮动操作按钮的位置设为静态

Making the new floating action button's position static

我将如何使我的 FAB 具有静态位置。即它不会在协调器布局的滚动中向上或向下移动?我在 res-auto 或常规 android 命名空间中没有看到选项..

布局如下:

 <?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
    android:id="@+id/root"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <RelativeLayout
        android:id="@+id/container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <LinearLayout
            android:id="@+id/search_polls_toolbar"
            android:layout_width="match_parent"
            android:layout_height="?android:actionBarSize"
            android:background="@color/icitizen_toolbar_orange"
            android:weightSum="1"
            >

            <!--<ImageView
                android:layout_width="30dp"
                android:layout_height="30dp"
                android:layout_marginRight="2dp"
                android:layout_marginTop="5dp"
                android:background="@drawable/magnifying_glass"/>-->

            <EditText
                android:id="@+id/search_polls"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:hint="@string/search_polls"
                android:gravity="center_horizontal"
                android:layout_weight=".5"
                android:drawableLeft="@drawable/magnifying_glass"
                android:drawableStart="@drawable/magnifying_glass"
                android:layout_marginTop="5dp"
                android:layout_marginLeft="15dp"
                android:drawablePadding="-50dp"
                android:paddingLeft="5dp"
                android:paddingTop="5dp"
                android:paddingBottom="10dp"
                android:cursorVisible="false"
                android:textSize="20sp"
                android:background="@color/icitizen_light_orange"
                />

        </LinearLayout>

        <android.support.v7.widget.RecyclerView
            android:id="@+id/poll_horizontal_recycler_view"
            android:layout_width="match_parent"
            android:layout_height="75dp"
            android:layout_below="@id/search_polls_toolbar"
            android:layout_marginLeft="10dp"
            android:layout_marginTop="5dp"
            android:scrollbars="none"
            >

        </android.support.v7.widget.RecyclerView>

        <android.support.v7.widget.RecyclerView
            android:id="@+id/poll_recycler_view"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginTop="10dp"
            android:layout_below="@id/poll_horizontal_recycler_view"
            android:scrollbars="vertical" />

    </RelativeLayout>

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/polls_fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/white_plus_icon"
        android:layout_marginBottom="70dp"
        app:backgroundTint="@color/icitizen_orange"
        app:layout_anchor="@id/container"
        app:layout_anchorGravity="bottom|right|end"
        app:borderWidth="0dp"
        android:layout_marginRight="15dp"
        android:layout_marginEnd="15dp"/>
</android.support.design.widget.CoordinatorLayout>

尝试将 fab 按钮放在侧框架布局中。 这个这个,

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

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/fabBtn"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|right"
        android:src="@drawable/ic_plus"
        app:fabSize="normal" />

</FrameLayout>