我使用协调器布局,回收站视图和浮动按钮。不知何故,fab按钮不会停留在布局的底部。我希望按钮即使在滚动时也能保持在最底部。我所知道的是,晶圆厂按钮在回收视图中占据最后一项的底部位置。如何让浮动按钮保持在布局的底部?
列表activity.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
tools:listitem="@layout/activity_sample_05borangb_parent"
android:id="@+id/recyclerView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="vertical"/>
</RelativeLayout>
<android.support.design.widget.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:foregroundGravity="bottom"
android:layout_gravity="bottom|end"/>
</android.support.design.widget.CoordinatorLayout>
删除'安卓scrollbars'或'安卓foregroundGravity'并有一个尝试。 – KeLiuyue
@KeLiuYue我试过了......但按钮仍然在布局的中间盘旋 – xxmilcutexx