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

[ExtendedFloatingActionButton] ExtendedFloatingActionButton shrinks/expands abruptly after animation due to width reset

Open Cai-kunkun opened this issue 4 months ago • 4 comments

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)

Cai-kunkun avatar Aug 02 '25 04:08 Cai-kunkun

Hi @Cai-kunkun, thank you for reaching out. Can you try the 2 following things to help narrow down the issue?

  1. Can you try the same setup / behavior on a phone instead of an emulator to see if the issue still happens?

  2. Can you try with version 1.12.0 of the Material library on both phone + emulator to see if the issue still happens?

dsn5ft avatar Aug 04 '25 13:08 dsn5ft

Hi @Cai-kunkun, thank you for reaching out. Can you try the 2 following things to help narrow down the issue?

  1. Can you try the same setup / behavior on a phone instead of an emulator to see if the issue still happens?
  2. 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)

Cai-kunkun avatar Aug 05 '25 06:08 Cai-kunkun

https://github.com/user-attachments/assets/dd3a039b-e9d2-41b1-bb73-b946e15b2740

Cai-kunkun avatar Aug 05 '25 06:08 Cai-kunkun

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?

dsn5ft avatar Aug 06 '25 16:08 dsn5ft