material-components-android
material-components-android copied to clipboard
[BottomAppBar] children are not laid out correctly
Description: The children of BottomAppBar are not laid out correctly when app:menuAlignmentMode is start (The children of BottomAppBar are laid out correctly when app:menuAlignmentMode is auto).
https://github.com/material-components/material-components-android/commit/397e48f2790a95878caf7523a026eabfac286c07

Expected behavior: The children of BottomAppBar are laid out correctly when app:menuAlignmentMode is start.

Source code:
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.bottomappbar.BottomAppBar
android:layout_width="match_parent"
android:layout_height="?actionBarSize"
android:layout_gravity="bottom"
android:layout_marginBottom="?actionBarSize"
app:menu="@menu/main"
app:menuAlignmentMode="auto">
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/auto" />
</com.google.android.material.bottomappbar.BottomAppBar>
<com.google.android.material.bottomappbar.BottomAppBar
android:id="@+id/appBar"
android:layout_width="match_parent"
android:layout_height="?actionBarSize"
android:layout_gravity="bottom">
<!-- app:menuAlignmentMode="start"-->
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/start" />
</com.google.android.material.bottomappbar.BottomAppBar>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
The default value of app:menuAlignmentMode (Widget.Material3.BottomAppBar) is not auto but start.
https://m3.material.io/components/bottom-app-bar/implementation
https://github.com/material-components/material-components-android/blob/master/lib/java/com/google/android/material/bottomappbar/res/values/styles.xml#L64
https://github.com/material-components/material-components-android/blob/master/docs/components/BottomAppBar.md
https://github.com/material-components/material-components-android/commit/397e48f2790a95878caf7523a026eabfac286c07
https://github.com/material-components/material-components-android/commit/276a0a3c5132a54ac9f1d7fafbd2ebbb084ac7d1
Minimal sample app repro: Test1.zip
Android API version: 32
Material Library version: 1.7.0-alpha03
Device: Emulator 31.2.10