Git Product home page Git Product logo

Comments (19)

iciakky avatar iciakky commented on May 20, 2024 3

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 :)

from circleimageview.

hdodenhof avatar hdodenhof commented on May 20, 2024 1

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

from circleimageview.

Rainer-Lang avatar Rainer-Lang commented on May 20, 2024

+1
please add shadow

from circleimageview.

 avatar commented on May 20, 2024

+1
for the shadow

Please ;)

from circleimageview.

hdodenhof avatar hdodenhof commented on May 20, 2024

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.

from circleimageview.

MiralDesai avatar MiralDesai commented on May 20, 2024

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?

from circleimageview.

bug-assassin avatar bug-assassin commented on May 20, 2024

Any update on this?

from circleimageview.

kevinvanzyl avatar kevinvanzyl commented on May 20, 2024

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.

from circleimageview.

Mardaklysm avatar Mardaklysm commented on May 20, 2024

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

from circleimageview.

NathanaelA avatar NathanaelA commented on May 20, 2024

You might try this technique: http://stackoverflow.com/questions/27092711/achieve-setshadowlayer-effect-during-drawcircle-or-drawroundrect-without-turni?noredirect=1&lq=1

from circleimageview.

MohammedAlSafwanOld avatar MohammedAlSafwanOld commented on May 20, 2024

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

from circleimageview.

MohammedAlSafwanOld avatar MohammedAlSafwanOld commented on May 20, 2024

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

from circleimageview.

hdodenhof avatar hdodenhof commented on May 20, 2024

@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.

from circleimageview.

MohammedAlSafwanOld avatar MohammedAlSafwanOld commented on May 20, 2024

@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?

from circleimageview.

KingWu avatar KingWu commented on May 20, 2024

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

from circleimageview.

hdodenhof avatar hdodenhof commented on May 20, 2024

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.

from circleimageview.

MohammedAlSafwanOld avatar MohammedAlSafwanOld commented on May 20, 2024

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

from circleimageview.

jemshit avatar jemshit commented on May 20, 2024

@hdodenhof is it for only api>=21?

from circleimageview.

longxuewei avatar longxuewei commented on May 20, 2024

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.

from circleimageview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.