Comments (19)
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.
Just a quick heads up: support for elevation is on its way: https://github.com/hdodenhof/CircleImageView/tree/feature/outline-provider.
from circleimageview.
+1
please add shadow
from circleimageview.
+1
for the shadow
Please ;)
from circleimageview.
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.
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.
Any update on this?
from circleimageview.
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.
This would be an awesome feature to this already great API !
from circleimageview.
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.
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.
@hdodenhof I already added it, look at my branch :)
from circleimageview.
@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.
@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.
@hdodenhof is it required to set a black background? Just use the circle image view with outline. No shadow is shown
from circleimageview.
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.
@hdodenhof .... That really didn't answer anyone my questions X'D
from circleimageview.
@hdodenhof is it for only api>=21?
from circleimageview.
Should I use
app:shadow="2dp"
orandroid:elevation="2dp"
? The former give me an errorerror: attribute 'path.to.my.package:shadow' not found.
and the latter seems produce no shadow on my CircleImageViewusing 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 swipingEDIT2: 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)
- The View can't work with android:scaleType attribute. HOT 1
- can I pass a letter and showed as Image ? HOT 2
- Load gif HOT 1
- Set three circle image view in same activity HOT 1
- CicleImageView doesn't work with FrameLayout HOT 2
- circular image view onclick listener not working HOT 1
- the following class could not be instantiated HOT 3
- App crash in Android OS version 7(nougat), Error inflating class de.hdodenhof.circleimageview.CircleImageView HOT 3
- Image gets rotate when setting to an ImageView HOT 1
- Pb dia HOT 1
- Circular image View destroy image px. HOT 2
- Width and height must be > 0 when using CircularProgressDrawable HOT 1
- Native Crash HOT 1
- CircleImageView OutOfMemoryError HOT 2
- Cy
- The following classes could not be instantiated: -Β de.hdodenhof.circleimageview.CircleImageView HOT 1
- Circle image view not working in android 7 HOT 1
- Image is cropped more from corners in Moto G5s Plus HOT 5
- Clarification: Can I able to add the text below the image using this package HOT 1
- Doesn't work in constrained layouts HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from circleimageview.