Clans / FloatingActionButton

Android Floating Action Button based on Material Design specification
Apache License 2.0
5.23k stars 1.13k forks source link

The picture is too big. #411

Closed buluojava closed 7 years ago

buluojava commented 7 years ago

FloatingActionButton , android:src="@drawable/your_icon_drawable" , Can images be sized? The picture is too big.

baggednismo commented 7 years ago

For images within a FAB/FAM you should be providing the image in the correct size. this library uses the standard FAB requirements for images so following android requirements it will work as expected. With that said, yes you can resize the image.

see this post for specs: https://stackoverflow.com/questions/27484126/adjust-icon-size-of-floating-action-button-fab

I prefer using and icon pack (vector images) so it reduces the project overall size and setting the image/size programmatically instead of XML like so: fab.setImageDrawable(new IconicsDrawable(getActivity()).icon(CommunityMaterial.Icon.cmd_pencil).color(Color.WHITE).sizeDp(24));

for a MINI FAB use 16dp like so fab.setImageDrawable(new IconicsDrawable(getActivity()).icon(CommunityMaterial.Icon.cmd_pencil).color(Color.WHITE).sizeDp(16));

buluojava commented 7 years ago

@baggednismo thank