I had the same problem with the misplaced image when using Picasso and Photoview together.
To solve it, what I do is to use a callback when loading the image with Picasso using into(view, callback)
instead of just into(view)
. Once the image is loaded successfully I instantiate the PhotoViewAttacher object or call the method update()
.
Here you have an example of code:
Callback imageLoadedCallback = new Callback() {
@Override
public void onSuccess() {
if(mAttacher!=null){
mAttacher.update();
}else{
mAttacher = new PhotoViewAttacher(mImageView);
}
}
@Override
public void onError() {
// TODO Auto-generated method stub
}
};
Picasso.with(mContext)
.load(mImageUrl)
.into(mImageView,imageLoadedCallback);
I hope this helps. Regards.