-
Notifications
You must be signed in to change notification settings - Fork 817
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added new fab_size property for custom size requirements #127
base: master
Are you sure you want to change the base?
Conversation
sfunke
commented
Feb 25, 2015
- new fab_size xml attribute
- allows for setting custom size (sometimes it's an requirement)
- if omitted, default values will be used
This is how it looks with a custom FAB size set to 42dp on the pre-Lollipop device: The white outline exists around the button because shadow is used as an image asset of a constant size. I had to adapt this shadow image to fully match two standard sizes but it's not stretched to custom size. So as long as we use shadow as an image, it's not possible to set a custom FAB size (with shadow). But I assume we can somehow generate a shadow in the runtime. I will invesigate this possibility. |
Aha, yes you are right, I think I tested it but may have missed to test it with sizes smaller than default. What do you think about constraining the size not to be smaller than the smallest default size? (48dp, I guess?) I think there may be the requirement for larger buttons, but not so much for smaller ones. Regarding generating runtime shadows, I did some experiments for custom dropshadows in another projects, basically black-painting the object, blur it, and draw it underneath the object. So this could work as well, although potential affections on performance should be considered. If you don't mind I'll have a look into it as soon as I have time. Thanks for the hint! |
@sfunke Did you have time to look into this again? |
Conflicts: README.md
@MGaetan89 Yes, I just added a fix on my fork, hopefully it gets pulled in. It's true that it's a bit whacky on pre-Lollipop devices to get the shadow straight. The current workaround is that the fixed size shadow drawable gets stretched accordingly (depending on the size), plus taking the shadow margin into account. Also I decided, that when It's been tested on Lollipop & pre-Lollipop, as well with larger & smaller FAB-sizes, and on different resolutions. @makovkastar What do you think? |