[英]How to put Floating Action Button in the bottom of the screen with Collapsing ToolBar to be always visible
我在活動中使用折疊工具欄時有帶有浮動操作按鈕的片段。 當工具欄折疊時,一切正常,但在展開時,FAB不可見(它在屏幕下方)。 這是我的FAB片段的xml:
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/layout">
<ListView
android:id="@+id/listView"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</RelativeLayout>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_anchor="@+id/layout"
app:layout_anchorGravity="bottom|right|end"
/>
</android.support.design.widget.CoordinatorLayout>
更換
app:layout_anchor="@+id/layout"
app:layout_anchorGravity="bottom|right|end"
同
android:layout_gravity="bottom|end"
這應該工作
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.