shamanland / floating-action-button

Implementation of a circular button made of paper that lifts and emits ink reactions on press.
http://shamanland.github.io/floating-action-button
Apache License 2.0
371 stars 88 forks source link

Shadow should be disable-able by XML property #10

Closed maniac103 closed 9 years ago

maniac103 commented 9 years ago

As mentioned in the title, one should be able to disable the shadow by an XML bool attribute. Use case is to use real shadows on API 21 by utilizing android:elevation instead of the shadow drawable.

ok3141 commented 9 years ago

Thanks for this report. I will fix it soon.

maniac103 commented 9 years ago

I would be even better if the library provided the correct ViewOutlineProvider for that case as well :)

jendib commented 9 years ago

About this, I tried to disable the gradient shadow and apply an android:elevation, however on my Android 5 device the cast shadow doesn't show up. Any idea? Something about this outline provider?

maniac103 commented 9 years ago

Without outline provider there should be a rectangular shadow around the button, no shadow at all sounds like a different thing though. Does your app you're testing this in target API 21?

jendib commented 9 years ago

Yes it's targeting API 21 and I have other android:elevation on the same layout which are working properly. Did you try something similar on your side at any point?

2014-11-26 7:37 GMT+01:00 maniac103 notifications@github.com:

Without outline provider there should be a rectangular shadow around the button, no shadow at all sounds like a different thing though. Does your app you're testing this in target API 21?

— Reply to this email directly or view it on GitHub https://github.com/shamanland/floating-action-button/issues/10#issuecomment-64521114 .

maniac103 commented 9 years ago

Nope, I didn't yet. After reading the code ([1]), it comes down to theme and/or drawable attributes, though:

I'm not sure whether the FAB's background provides an outline, so it's probably better to provide a custom one, which matches what AOSP apps are doing (e.g. [2], line 163)

[1] https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/view/View.java [2] https://android.googlesource.com/platform/packages/apps/DeskClock/+/master/src/com/android/deskclock/DeskClock.java

jendib commented 9 years ago

Seems to work just great :) I've made a PR #11

ok3141 commented 9 years ago

Fixed and published with version 0.0.6 - available on Maven Central.