I want to create a bigger Floating Action Button (FAB), more than the usual 56 dp, with a bigger icon inside. (For my purpose an icon will never be self-explanatory so I will cr
Since Design Support Library 27.1.0 there is an official way to set custom FAB size: app:fabCustomSize XML attribute and corresponding setCustomSize method. For increasing icon size you can use android:scaleType="center"
and larger drawable. UPDATE: android:scaleType
is now broken, use fab.setScaleType(ImageView.ScaleType.CENTER)
instead.
Other proposed solutions have some drawbacks:
layout_width
and layout_height
to desired size, which has the same effect) looks awfully on pre-Lollipop devices. UPDATE: Now on post-Lollipop too (see screenshots below).Sample layout as rendered on API 19 (left) and API 21 (right):