question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[FloatingActionButton] Behavior change in 1.2.0 - different behavior and strange animation when toggling isEnabled attribute

See original GitHub issue

Description: After bumping library version the FloatingActionButton changes behavior when setting isEnabled=false. In 1.2.0 it: a) loses background color b) shows strange octogonal shape image

Expected behavior: Behavior doesn’t change after library update (or at least it is clearly metioned in the release notes)

1.1.0 1.2.0
1_1_0 1_2_0

Source code: https://github.com/mateuszkwiecinski/fab_animation_issue just downgrade the library version to 1.1.0

Android API version: 29

Material Library version: 1.2.0

Device: Multiple

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
gabrielemariotticommented, Aug 15, 2020

About the background color it is not a bug. The version 1.2.0 changed the background color and icon tint to support for enabled/disabled state in the FloatingActionButton.

From:

    <item name="backgroundTint">?attr/colorSecondary</item>
    <item name="tint">?attr/colorOnSecondary</item>

To:

    <item name="backgroundTint">@color/mtrl_fab_bg_color_selector</item>
    <item name="tint">@color/mtrl_fab_icon_text_color_selector</item>

You can check the selector:

<selector xmlns:android="http://schemas.android.com/apk/res/android">
  <item android:color="?attr/colorSecondary" android:state_enabled="true"/>
  <item android:alpha="0.12" android:color="?attr/colorOnSurface"/>
</selector>

The disabled state is based on colorOnSurface. In your case you are using the default value (#000000 with alpha=0.12)

I’ve submitted a PR to add the info about the states in the doc (#1619).

0reactions
dawidmoskcommented, Sep 24, 2022

But what to do with transparent button? It’s occur.

Read more comments on GitHub >

github_iconTop Results From Across the Web

android - How to enable/disable FloatingActionButton Behavior
I am working on app in some fragment i want to hide FloatingActionButtton. When i set android:visibility="gone". Behavior animation show me ...
Read more >
Compose Material - Android Developers
Build animations in their Jetpack Compose applications to enrich the user experience. compose.compiler, Transform @Composable functions and enable optimizations ...
Read more >
FloatingActionButton class - material library - Dart API
If the onPressed callback is null, then the button will be disabled and will not react to touch. It is highly discouraged to...
Read more >
Button - KivyMD 1.2.0.dev0 documentation
Material Design spec, Buttons: floating action button ... You can change the color of MDIconButton as the text color of MDLabel , substituting ......
Read more >
AnimatedVisibility doesn't work with FloatingActionButton in ...
With some animation types, including AnimatedVisibility default ones, the view doesn't appear at all. var flag by remember { mutableStateOf(true) } Scaffold( ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found