Theme.MaterialComponents.Light.DarkActionBar ломает колыбель FAB - PullRequest
0 голосов
/ 10 января 2020

Почему используется

<style name="AppTheme" parent="Theme.AppCompat.DayNight">
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
    <item name="colorControlNormal">@color/colorPrimaryDark</item>
    <item name="colorControlActivated">@color/colorPrimary</item>
    <item name="iconColor">@color/greyBlue</item>
    <item name="android:windowContentTransitions">true</item>
    <item name="android:windowBackground">@drawable/blue_gradient_background</item>
</style>

Результат в

enter image description here

И расширение от MaterialComponents, например, так:

<style name="AppTheme" parent="Theme.MaterialComponents.Light.DarkActionBar">
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
    <item name="colorControlNormal">@color/colorPrimaryDark</item>
    <item name="colorControlActivated">@color/colorPrimary</item>
    <item name="iconColor">@color/greyBlue</item>
    <item name="android:windowContentTransitions">true</item>
    <item name="android:windowBackground">@drawable/blue_gradient_background</item>
</style>

Результаты:

enter image description here

Вот код AppBar:

<com.google.android.material.bottomappbar.BottomAppBar
    android:id="@+id/bottomAppBar"
    style="@style/Widget.MaterialComponents.BottomAppBar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom"
    app:contentInsetStart="0dp"
    app:fabAlignmentMode="center"
    app:hideOnScroll="true">

    <com.google.android.material.bottomnavigation.BottomNavigationView
        android:id="@+id/bottom_navigation"
        style="@style/Widget.MaterialComponents.BottomNavigationView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:labelVisibilityMode="labeled"
        app:menu="@menu/bottomappbar_menu" />

    </com.google.android.material.bottomappbar.BottomAppBar>

<com.google.android.material.floatingactionbutton.FloatingActionButton
    android:id="@+id/fab"
    style="@style/Widget.MaterialComponents.FloatingActionButton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/ic_add_black_24dp"
    app:layout_anchor="@id/bottomAppBar"
    app:rippleColor="@color/colorPrimary" />

Если у кого-то есть идеи или точки в правильном направлении. Я в недоумении, тем более что официальная документация говорит о расширении от MaterialComponents (https://material.io/develop/android/components/bottom-app-bar/)

Я использую "com.google.android.material:material:1.0.0"

Править : Обновление до "com.google.android.material:material:1.2.0-alpha03" не имеет значения, за исключением того, что оно меняет цвет во время выполнения фона FAB. Предварительный просмотр теперь выглядит так: enter image description here

Другое редактирование: Вот изображение, показывающее, что во время выполнения ничего не изменилось, за исключением цвета, который я упомянул. enter image description here

...