0
我在viewpager內部有片段,所以片段由Recyclerview和FloatingActionButton組成。所以當我滾動recyclerview工具欄摺疊和tablayout引腳,但浮動操作按鈕也滾動。我想將FlaotingActionButton固定到它的位置。無法在工具欄摺疊時固定FloatingActionButton
現在,當我滾動欄collpase和floatingactionbutton也向上移動。 -
請讓我知道如何將FloatingActionButton固定在右下方。
氏是XML文件 -
<android.support.design.widget.CoordinatorLayout
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:id="@+id/coordinatorLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:fitsSystemWindows="true">
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/md_grey_200" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="16dp"
android:src="@drawable/ic_calendar_icon"
app:backgroundTint="@color/primary"
app:elevation="2dp"
app:fabSize="normal"
app:layout_anchor="@+id/recycler_view"
app:layout_anchorGravity="bottom|right|end"
app:layout_dodgeInsetEdges="right|bottom|top|left"
app:layout_insetEdge="bottom"
app:pressedTranslationZ="12dp" />
</android.support.design.widget.CoordinatorLayout>
嘗試改變晶圓廠錨這樣:@ + ID/coordinatorLayout –
@BrunoFerreira並沒有工作。說查看不能錨定到父級佈局。 – rahul