[英]fixed floating action button in fragment
i have fab and i want fixed on position end|right|bottom . 我有晶圆厂,我想固定在位置end | right | bottom上。 but in my fragment it hide and show with scroll recycler .
但在我的片段中,它与滚动回收器一起隐藏和显示。 and not show all fab in fragment because i use tab and toolbar.
而不是显示片段中的所有晶圆厂,因为我使用选项卡和工具栏。 please help?
请帮忙?
<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"
/>
删除2行app:layout_behavior="@string/appbar_scrolling_view_behavior"
和android:layout_gravity="bottom|end"
Try this xml
试试这个
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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.