[ExtendedFloatingActionButton] ExtendedFloatingActionButton shrinks/expands abruptly after animation due to width reset
Description: After clicking EFAB(ExtendedFloatingActionButton,for easy writing), it will reset the width and does not match with the animation width.
Behavior:
https://github.com/user-attachments/assets/788aebce-2070-49ac-9ecb-00704df11baf
Source code: com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
Minimal sample app repro: Github
Android API version: Min 21 ; Target 33
Material Library version: 1.13.0-rc01
Device: Redmi Turbo 4 Pro (HyperOS with Android 15)
Hi @Cai-kunkun, thank you for reaching out. Can you try the 2 following things to help narrow down the issue?
-
Can you try the same setup / behavior on a phone instead of an emulator to see if the issue still happens?
-
Can you try with version 1.12.0 of the Material library on both phone + emulator to see if the issue still happens?
Hi @Cai-kunkun, thank you for reaching out. Can you try the 2 following things to help narrow down the issue?
- Can you try the same setup / behavior on a phone instead of an emulator to see if the issue still happens?
- Can you try with version 1.12.0 of the Material library on both phone + emulator to see if the issue still happens?
1.Yep this also happened on my phone (Android 15) with light and dark mode.
2.I tried on phone and emulator and this issue also happened. (Emulator API36.0)
https://github.com/user-attachments/assets/dd3a039b-e9d2-41b1-bb73-b946e15b2740
Thanks for trying out those additional setups. I cloned your minimal sample GitHub repo and do see the subtle glitch at the end of the extend animation.
Also, I tried adding the following to our Catalog EFAB demo:
if (extendedFab.isExtended()) {
extendedFab.shrink();
} else {
extendedFab.extend();
}
https://github.com/material-components/material-components-android/blob/015e0534e1a6205224097f258102f913832f99ed/catalog/java/io/material/catalog/fab/ExtendedFabDemoFragment.java#L65-L69
And updated our Catalog theme to Theme.Material3.DynamicColors.DayNight.NoActionBar to match your sample app:
https://github.com/material-components/material-components-android/blob/015e0534e1a6205224097f258102f913832f99ed/catalog/java/io/material/catalog/application/theme/res/values/themes.xml#L19
But the animation looks smooth to me in that setup:
https://github.com/user-attachments/assets/563186e3-9891-44e8-a0ce-5a6e064f6328
Any chance you would be able to try running our Catalog app and comparing your setup to help identify the exact conditions needed to reproduce the issue?