Android 固定浮动动作按钮在片段

Android 固定浮动动作按钮在片段,android,floating-action-button,Android,Floating Action Button,我有晶圆厂,我想固定在位置结束|右|底部。 但在我的片段中,它用卷轴回收器隐藏和显示。 并没有在片段中显示所有的fab,因为我使用了选项卡和工具栏。 请帮忙 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http

我有晶圆厂,我想固定在位置结束|右|底部。 但在我的片段中,它用卷轴回收器隐藏和显示。 并没有在片段中显示所有的fab,因为我使用了选项卡和工具栏。 请帮忙

<RelativeLayout 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"
            tools:context="com.example.hadi.music.fragment.ListStoryFragment">

<android.support.v7.widget.RecyclerView
    android:id="@+id/rec_view_story"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    />

<android.support.design.widget.FloatingActionButton
    android:id="@+id/fab"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="false"
    android:layout_alignParentRight="true"
    android:layout_alignParentTop="false"
    android:layout_gravity="bottom|end"
    android:layout_marginRight="20dp"
    android:layout_marginBottom="40dp"
    android:clickable="true"
    android:src="@drawable/icon_plus"
    app:fabSize="normal"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    />


删除两行
应用程序:布局\u行为=“@string/appbar\u滚动\u查看\u行为”


android:layout_gravity=“bottom | end”
试试这个
xml

<android.support.design.widget.CoordinatorLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">

      <android.support.v7.widget.RecyclerView
          android:id="@+id/topic_list_recycler_view"
          android:layout_width="match_parent"
          android:layout_height="wrap_content" />

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/add_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|end"
        android:layout_margin="16dp"
        android:src="@drawable/ic_add"
        app:fabSize="normal" />

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


这是您的全部布局代码吗?是的,这是我的布局,不工作,再次滚动时隐藏并显示,不显示所有工厂