Вы можете использовать атрибут app:shapeAppearanceOverlay
, чтобы получить квадратную кнопку, и атрибут app:fabCradleVerticalOffset
, чтобы изменить расстояние FAB до BottomAppBar
.
Что-то вроде:
<com.google.android.material.bottomappbar.BottomAppBar
app:fabCradleVerticalOffset="16dp"
app:fabCradleRoundedCornerRadius="0dp"
app:fabCradleMargin="0dp"
..>
<com.google.android.material.floatingactionbutton.FloatingActionButton
app:shapeAppearanceOverlay="@style/SquareFloatingShapeOVerlay"
../>
с:
<style name="SquareFloatingShapeOVerlay" parent="">
<item name="cornerSize">0dp</item>
</style>
![enter image description here](https://i.stack.imgur.com/rILFx.png)
Если вы хотите прямоугольник angular форма, которую вы можете использовать ExtendedFloatingActionButton
вместо FloatingActionButton
.
Что-то вроде:
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
app:layout_anchor="@id/bottom_app_bar"
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlayExtended"
../>
с:
<style name="ShapeAppearanceOverlayExtended" parent="">
<item name="cornerFamily">rounded</item>
<item name="cornerSize">0dp</item>
</style>
![enter image description here](https://i.stack.imgur.com/rU2IB.png)
Примечание: требуется версия 1.1.0
библиотеки компонентов материала.