Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BottomNavigationView] Active indicator blinking on the edges (API 28) #2878

Open
b-brebion opened this issue Jul 30, 2022 · 4 comments
Open

Comments

@b-brebion
Copy link

Description:
When changing tab, the pill-shaped active indicator is blinking on the edges.

API28
(Android 9 device)

Expected behavior:

API32
(Android 12 device)

Source code:

<!-- activity_main.xml -->
<com.google.android.material.bottomnavigation.BottomNavigationView
        android:id="@+id/bottom_navigation"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_constraintBottom_toBottomOf="parent"
        app:menu="@menu/bottom_navigation_menu" />
<!-- bottom_navigation_menu.xml -->
<menu xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:id="@+id/recognition"
        android:icon="@drawable/recognition_selector"
        android:title="@string/recognition"/>
    <item
        android:id="@+id/draw"
        android:icon="@drawable/draw_selector"
        android:title="@string/draw"/>
</menu>
<!-- Selector example -->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@drawable/ic_filled_recognition"
        android:state_checked="true"/>
    <item android:drawable="@drawable/ic_outlined_recognition"
        android:state_checked="false"/>
</selector>

Android API version:
Android 9 (API 28)

Material Library version:
1.7.0-alpha03

Device:
Tested on Pixel 2 (Emulator) and Huawei P10
(Not able to reproduce the bug on Pixel 3a (API 32) and Asus Zenpad 3s 10 (API 24))

@b-brebion b-brebion added the bug label Jul 30, 2022
@drchen
Copy link
Contributor

drchen commented Aug 1, 2022

Looks like it's caused by ripples. Maybe we should disable ripple on clicking. Will check with the team.

@c1rcle
Copy link

c1rcle commented Nov 25, 2022

Any progress on this? I was able to reproduce this bug on Samsung Galaxy A33 (API 33). Setting item ripple color to null seems to fix this issue.

@philip-lackmann
Copy link

I was able to mitigate this issue by shortening the duration of the active indicator animator. Which is possible by overlaying the theme's motion duration. Originally this duration is around 500ms, so the ripple is animated way faster than the active indicator, which leads to this effect.

<style name="MyTheme.ThemeOverlay.BottomNavigation" parent="">
	<!-- item's active indicator animation duration -->
	<item name="motionDurationLong2">200</item>
</style>

I recommend playing around with the duration value according to taste

and then in your bottom navigation style
<item name="theme">@style/MyTheme.ThemeOverlay.BottomNavigation</item>

A more sustainable solution would be more than welcome though.

@Jesse205
Copy link

I consider both of these to be anomalies.This is how it behaves on my android 13 device and I think it is normal.
17214132485247416619127780206518.gif

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants