[英]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.