Skip to content
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

Shadow #50

Closed
crysan opened this issue Apr 3, 2015 · 19 comments
Closed

Shadow #50

crysan opened this issue Apr 3, 2015 · 19 comments

Comments

@crysan
Copy link

crysan commented Apr 3, 2015

please create app:shadow="2dp"

@Rainer-Lang
Copy link

+1
please add shadow

@Dreamystify
Copy link

+1
for the shadow

Please ;)

@hdodenhof
Copy link
Owner

There's a PR to address this: #42.

The problem with this approach is that LAYER_TYPE_SOFTWARE slows down drawing dramatically and I really want to avoid that.

I'm open for any ideas on how to address this in another way though.

@MiralDesai
Copy link

To be fair isn't that how Android expects you to add a shadow? I would say it's an issue with android rather than your implementation.

One thing I was trying to do was add a drawable shape around the CircleImageView, but it was wrapping to the full view which is a square, maybe if you change that we can add a shape drawable around the image to fake a shadow?

@bug-assassin
Copy link

Any update on this?

@kevinvanzyl
Copy link

I have a chain of circular images that increase in size from outside to the middle, they overlap slightly and the elevation increases as well. It just looks strange to have it all flat. I would be very happy if this was added.

@Mardaklysm
Copy link

This would be an awesome feature to this already great API !

@MohammedAlSafwanOld
Copy link

I committed a branch that fix this issue but I don't know if the head dev will commit it to the master branch. instead of applying a shadow, I made the the view accept elevation for devices >= Lollipop

@hdodenhof
Copy link
Owner

Just a quick heads up: support for elevation is on its way: https://github.com/hdodenhof/CircleImageView/tree/feature/outline-provider.

@MohammedAlSafwanOld
Copy link

@hdodenhof I already added it, look at my branch :)

@hdodenhof
Copy link
Owner

@NyanRex52 great, I somehow missed that. Making the OutlineProvider an inner class of CircleImageView you can actually optimize its code by accessing the calculated dimensions - have a look: 4fdd9db#diff-a2b6e34c868bc3478e513ae62c44e9b6R449.

@MohammedAlSafwanOld
Copy link

@hdodenhof That even looks more beautiful than what I did and less calculations. May I ask for two things:

  • May I be part in the credit for this part?
  • I added Ripple effect by difficult as foreground, would that be an interest feature to be added in this project?

@KingWu
Copy link

KingWu commented Aug 4, 2017

@hdodenhof is it required to set a black background? Just use the circle image view with outline. No shadow is shown

@hdodenhof
Copy link
Owner

Version 2.2.0 includes support for elevation, thanks @NyanRex52 for the initial idea. This should satisfy the original requirement for a shadow property, hence closing this issue.

@MohammedAlSafwanOld
Copy link

@hdodenhof .... That really didn't answer anyone my questions X'D

@jemshit
Copy link

jemshit commented Apr 19, 2018

@hdodenhof is it for only api>=21?

@iciakky
Copy link

iciakky commented May 7, 2018

Should I use app:shadow="2dp" or android:elevation="2dp" ?
The former give me an error error: attribute 'path.to.my.package:shadow' not found.
and the latter seems produce no shadow on my CircleImageView

using version 2.2.0
and running on android 5.0.2

EDIT:
looks like android:elevation="2dp" is the answer, as my shadow shows right after I swipe the RecyclerView containing (indirectly) these CircleImageView, still don't know why they're hiding before swiping

EDIT2:
It seems to me that the cause is: I'm using Glide loading image from url into CircleImageView, which must be done asynchronously, thus CircleImageView decided not to cast any shadow for there is no image (yet).
Base on this, I solve this problem with placeholder.
e.g. Glide.with(context).load(imageUrl).placeholder(R.color.lighter_gray).dontAnimate().into(my_circle_image_view)
hope this is helping :)

@longxuewei
Copy link

Should I use app:shadow="2dp" or android:elevation="2dp" ? The former give me an error error: attribute 'path.to.my.package:shadow' not found. and the latter seems produce no shadow on my CircleImageView

using version 2.2.0 and running on android 5.0.2

EDIT: looks like android:elevation="2dp" is the answer, as my shadow shows right after I swipe the RecyclerView containing (indirectly) these CircleImageView, still don't know why they're hiding before swiping

EDIT2: It seems to me that the cause is: I'm using Glide loading image from url into CircleImageView, which must be done asynchronously, thus CircleImageView decided not to cast any shadow for there is no image (yet). Base on this, I solve this problem with placeholder. e.g. Glide.with(context).load(imageUrl).placeholder(R.color.lighter_gray).dontAnimate().into(my_circle_image_view) hope this is helping :)

oh god you saved me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests