2017-07-03 3 views
0

ich habe fab und ich will auf position ende fixiert | rechts | unten. aber in meinem Fragment verstecken und zeigen mit Scroll Recycler. und nicht alle Fab in Fragment zeigen, weil ich Tab und Symbolleiste verwenden. bitte helfen?behoben floating action-taste in fragment

<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" 
    /> 

+0

Ist das Ihr gesamtes Layout-Code? –

+0

ja es ist mein Layout –

Antwort

0

Remove 2 Zeilen app:layout_behavior="@string/appbar_scrolling_view_behavior" und android:layout_gravity="bottom|end"

+0

nicht arbeiten es ausblenden und zeigen, wenn Sie erneut scrollen und nicht alle Fab anzeigen –

0

Versuchen Sie, diese 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>