Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

306
Views
Android Floating Action button : Resize inside icon

enter image description here

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

about 4 years ago · Santiago Trujillo
3 answers
Answer question

0

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:

enter image description here

about 4 years ago · Santiago Trujillo Report

0

you can use fabSize attribute

app:fabSize="normal" 
about 4 years ago · Santiago Trujillo Report

0

Try this: android:scaleType="center" and try image size 56dp. It worked for me.

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!