How to change Floating Action Button Size in Android

In android, there are different ways to change floating action button size in android.

We will show the code snippet for each method below.

Using dimens.xml file

In your android project values directory, we will create a dimens.xml file which we can use to override the default android attributes values.

<dimen name="design_fab_size_normal" tools:override="true">90dp</dimen>
<dimen name="design_fab_size_mini" tools:override="true">30dp</dimen>

As can be seen above, the default values of design_fab_size_normal and design_fab_size_minihave been changed

Using app:fabCustomSize

The simplest way to achieve this in XML code is my using FAB app:fabCustomSizeattribute as show below.

        app:srcCompat="@android:drawable/btn_dialog" />

In the next code snippet, you will learn different ways you can use to increase the size of android floating action button in android.



Add a Comment