I want to display this png as my floating action button. But when I set this as my src, I get a black icon instead. How can I do it?
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="@null"
android:backgroundTint="@null"
android:cropToPadding="true"
android:outlineSpotShadowColor="@null"
android:src="@drawable/ic_esaathi_icon"
app:borderWidth="0dp"
app:elevation="6dp"
app:maxImageSize="56dp" />
Edit: Sarath Siva's answer works fine.
app:srcCompat="@drawable/icon_02"
remove background, try to set eg transparent or white color (or @null
), but use custom lib attributes (eg app:
) instead of built-in ones ( android:
)
app:backgroundTint="@android:color/transparent"
app:tint="@android:color/transparent"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.