Android: How to change size of app:fabSize="normal" for Floating Action Button

michael picture michael · Oct 1, 2015 · Viewed 43.9k times · Source

When using the new FloatingActionButton, the size is determined by app:fabSize="normal". How can I set what in dp is the size referenced by "normal"?

I tried to create values/attrs.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <declare-styleable name="app">
        <attr name="fabSize">
            <enum name="mini" value="50dp" />
            <enum name="normal" value="100dp" />
        </attr>
    </declare-styleable>
</resources>

But I get the error

"normal" in attribute "fabSize" is not a valid integer

Answer

Hoshouns picture Hoshouns · Oct 1, 2015

There are two different sizes of FAB available: normal or mini

  1. Normal (56dp) — This size should be used in most situations.

  2. Mini (40dp) — Should only be used when there is a need for visual continuity with other components displayed on the screen.