FloatingActionButton icon indicating copy to clipboard operation
FloatingActionButton copied to clipboard

Request: allow to use any size

Open AndroidDeveloperLB opened this issue 10 years ago • 5 comments

mini and normal aren't always enough... I assume that the problematic part here is the shadow, but maybe there is a way to create it on demand?

AndroidDeveloperLB avatar Jan 25 '15 14:01 AndroidDeveloperLB

+1 (although the size it's stated in the guidelines, it would be useful for in some cases)

dirkam avatar Jan 25 '15 15:01 dirkam

I also think that the size should include the shadow, to avoid confusion of why it gets truncated.

AndroidDeveloperLB avatar Jan 25 '15 15:01 AndroidDeveloperLB

Just opened a pull request from my fork, where I implemented this feature out of own needs: https://github.com/makovkastar/FloatingActionButton/pull/127

Fingers crossed that it gets pulled in ;-)

In the meantime, feel free to take my branch at https://github.com/sfunke/FloatingActionButton/tree/feature/free-size

Just add a fab_size attribute to the xml where you include the button in layout, and give it a dimension value.

sfunke avatar Feb 25 '15 08:02 sfunke

Until this is integrated in the library, I just scale the button as follow:

fab.setScaleX(0.75f);
fab.setScaleY(0.75f);

Didn't test it with shadow enable though.

MGaetan89 avatar Apr 14 '15 12:04 MGaetan89

You can also override R.dimen.fab_size_normal or R.dimen.fab_size_mini to anything you want by adding the same dimensions into your dimens.xml:

<dimen name="fab_size_mini">40dp</dimen>
<dimen name="fab_size_normal">56dp</dimen>

Their default values are 40dp and 56dp.

dimens.xml in the library Answer source

mustafaberkaymutlu avatar Sep 18 '17 10:09 mustafaberkaymutlu