我使用協調器佈局,回收站視圖和浮動按鈕。不知何故,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