如何在底部应用栏前设置 FAB? [英] How to set FAB in front of bottom app bar?

本文介绍了如何在底部应用栏前设置 FAB?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将浮动操作按钮置于底部应用栏前?换句话说,如何设置底部应用栏以填充晶圆厂后面的整行?

从此:

对此:

图像来自

How can I bring the floating action button in front of the bottom app bar? In other words, how to set the bottom app bar to fill the entire row behind the fab?

From this:

To this:

Images via medium.com

According to this tutorial there should be an attribute named fabCradleDiameter but in reality there is no such attribute for this component.

解决方案

Just use the official BottomAppBar and use the:

  • fabCradleMargin attribute. It increases or decreases the distance between the FloatingActionButton and the BottomAppBar
  • fabCradleRoundedCornerRadius attribute. It specifies the roundness of the corner around the cutout

Use:

<com.google.android.material.bottomappbar.BottomAppBar
    android:id="@+id/bar"
    android:layout_gravity="bottom"
    app:fabCradleMargin="0dp"
    app:fabCradleRoundedCornerRadius="0dp"
    ... />

<com.google.android.material.floatingactionbutton.FloatingActionButton
    app:layout_anchor="@id/bar"
    .../>

这篇关于如何在底部应用栏前设置 FAB?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆