FloatingActionButton
FloatingActionButton copied to clipboard
Request: allow to use any size
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?
+1 (although the size it's stated in the guidelines, it would be useful for in some cases)
I also think that the size should include the shadow, to avoid confusion of why it gets truncated.
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.
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.
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.