
Hi I want to set image into FloatingActionButton i did this :
<android.support.design.widget.FloatingActionButton
            android:id="@+id/qick_menu"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="20dp"
            android:src="@drawable/quick_menu"
            app:elevation="7dp"
            app:layout_anchor="@id/mapview"
            app:layout_anchorGravity="bottom|right|end" />
But I have a small image in my button
The image/icon inside FAB can be resized in XML.
app:maxImageSize = "32dp" This will be your image size inside Floating Action Button.
app:fabCustomSize = "64dp" This will be your Floating Action Button size.
try this: in Layout:
    <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <android.support.design.widget.FloatingActionButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:padding="0dp"
        android:scaleType="fitXY"
        android:src="@drawable/map"
        app:backgroundTint="@android:color/transparent"
        app:borderWidth="0dp"
        app:useCompatPadding="true" />
</RelativeLayout>
Now in res/values/dimens.xml:
<resources xmlns:tools="http://schemas.android.com/tools">
    <!-- Default screen margins, per the Android Design guidelines. -->
    <dimen name="fab_margin">16dp</dimen>
    <dimen name="design_fab_image_size" tools:override="true">56dp</dimen>
</resources>
This line is important <dimen name="design_fab_image_size" tools:override="true">56dp</dimen>
output:

you can use fabSize attribute
app:fabSize="normal" 
                        Try this: android:scaleType="center" and try image size 56dp. It worked for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With