material-components-android icon indicating copy to clipboard operation
material-components-android copied to clipboard

[BottomAppBar] children are not laid out correctly

Open manabu-nakamura opened this issue 3 years ago • 0 comments
trafficstars

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 Screenshot_20220722_125942

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

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

manabu-nakamura avatar Jul 22 '22 04:07 manabu-nakamura