Question Detail

I am getting Error in app:srcCompat="@drawable/ic_adduser" while using FloatingActionButton How to resolve this?

6 years ago Views 1771 Visit Post Reply

Hello Everybody,
I am Using FloatingActionButton and I want to change its inside Icon but it gives me Error To use VectorDrawableCompat, you need to set android.defaultConfig.

<android.support.design.widget.FloatingActionButton
    android:id="@+id/fab"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="end|bottom"
    android:layout_marginRight="@dimen/fab_margin"
    android:layout_marginBottom="@dimen/searchImageSize"
    app:srcCompat="@drawable/ic_adduser"/>


Thread Reply

Bili Greed

- 6 years ago

Don't

android:srcCompat="@drawable/wallpaper"

Do

app:srcCompat="@drawable/wallpaper"

as it srcCompat attribute is actually defined within AppCompat library.

Important you will need to add appropriate namespace for this.

xmlns:app="http://schemas.android.com/apk/res-auto"

Important

what you are getting it seems like it is just a lint error that can be ignored. I have tried and have the same error, but it is working correctly.

you can use tools:ignore="MissingPrefix" to avoid seeing this error temporarily.