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

FloatingActionButton warning in logcat: Setting a custom background is not supported #283

Closed
adil-hussain-84 opened this issue Feb 15, 2019 · 1 comment

Comments

@adil-hussain-84
Copy link

I'm using the latest version of the com.google.android.material:material library (i.e. 1.1.0-alpha03) and I have an app theme defined as follows...

<style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
    <item name="colorAccent">@color/green</item>
    <item name="colorControlHighlight">@color/green</item>
    <item name="colorPrimary">@color/green</item>
    <item name="colorPrimaryDark">@color/dark_green</item>
    <item name="colorOnPrimary">@color/white</item>
    <item name="colorSecondary">@color/green</item>
    <item name="colorOnSecondary">@color/white</item>
</style>

... and a FloatingActionButton defined as follows...

<com.google.android.material.floatingactionbutton.FloatingActionButton
    android:id="@+id/floatingActionButton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:fabSize="normal"
    app:srcCompat="@drawable/icon_plus" />

... the FloatingActionButton is displaying perfectly fine in my app but I'm seeing the following message in Logcat...

I/FloatingActionButton: Setting a custom background is not supported.

... I'm not setting a background on the FloatingActionButton anywhere in my app.

Is it something I've done incorrectly in setting up the FloatingActionButton to trigger this message or is it a bug?

@adil-hussain-84 adil-hussain-84 changed the title FloatingActionButton: Setting a custom background is not supported FloatingActionButton warning in logcat: Setting a custom background is not supported Feb 15, 2019
@ymarian
Copy link
Contributor

ymarian commented Feb 20, 2019

Hi good catch, this is because we are setting a background in Widget.Design.FloatingActionButton.
you can add android:background="@null" to your fab or safely ignore this warning. I'll see if we can set that in the default style.

@ymarian ymarian closed this as completed Feb 20, 2019
markusfisch added a commit to markusfisch/BinaryEye that referenced this issue Nov 3, 2022
To silence this warning:

> I/FloatingActionButton: Setting a custom background is not supported.

Details:
material-components/material-components-android#283
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants