Comments (4)
I was able to overcome this problem by using a custom Target when setting the loaded image in the CircleImageView:
Picasso.with(context)
.load(url)
.placeholder(placeholderId)
.error(placeholderId)
.into(new Target(){
@Override
public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
imageView.setImageDrawable(
new
BitmapDrawable
(context.getResources(), bitmap));
}
@Override
public void onBitmapFailed(final Drawable errorDrawable) {
Log.d("TAG", "FAILED");
}
@Override
public void onPrepareLoad(final Drawable placeHolderDrawable) {
Log.d("TAG", "Prepare Load");
}
});
instead of just using
Picasso.with(context).load("http://i.imgur.com/DvpvklR.png").into(imageView);
from circleimageview.
If you are using Picasso without the noFade()
option, this is probably the same issue as #3. When Picasso finished loading, it replaces the placeholder in the ImageView with the actual image but with an alpha value of 0 and then starts fading it in. The fadein is handled within the PicassoDrawable and there is no way for the ImageView to realize it has to refresh. When you scroll the view out of the viewport and then back in, Picasso starts loading again, realizes that the image is cached in memory and skips the placeholder - that's why it work's in that case.
My suggested solution in #3 is exactly what you did. If you want to keep the fadein animation, you could place the necessary code in onBitmapLoaded
instead of just using setImageDrawable
there. If you don't want the animation anyways, another workaround would be using Picassos noFade
option.
I'll probably update the README with these hints. Thanks!
from circleimageview.
Ok, thanks for the noFade tip - this seems to work better than my workaround.
+1 for writing it to the README file. Since your library works good with Picasso, you should directly inform users about it (so that they don't get frustrated with your lib).
from circleimageview.
Also see this issue for discussion upstream.
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.