rma*_*mad 3 android android-imageview picasso touchimageview
我使用Universal Image Loader库加载一组图像和TouchImageView以允许缩放.我决定用毕加索取代Universal Image Loader.一切都很好,除了现在图像缩放到比图像稍大的帧.
@Override
public Object instantiateItem(ViewGroup view, int position) {
View imageLayout = inflater.inflate(R.layout.item_pager_image, view, false);
assert imageLayout != null;
TouchImageView imageView = (TouchImageView) imageLayout.findViewById(R.id.image);
final ProgressBar spinner = (ProgressBar) imageLayout.findViewById(R.id.loading);
spinner.setVisibility(View.INVISIBLE);
Picasso.with(getApplicationContext()).setIndicatorsEnabled(false);
Picasso.with(getApplicationContext()).load(images[position]).into(imageView,new Callback() {
@Override
public void onSuccess() {
spinner.setVisibility(View.GONE);
}
@Override
public void onError() {
}
});
view.addView(imageLayout, 0);
return imageLayout;
Run Code Online (Sandbox Code Playgroud)
为此,我几个小时就一直在挣扎.这是TouchImageView与Picasso有关的问题吗?任何帮助都会很明显.谢谢.
Mahram Foadi在这里发布了一个很适合我的解决方案:
Picasso.with(context).load (someUri).into(new Target () {
@Override
public void onBitmapLoaded (final Bitmap bitmap,
final Picasso.LoadedFrom loadedFrom) {
someTouchImageView.setImageBitmap (bitmap);
}
@Override
public void onBitmapFailed (final Drawable drawable) {
Log.d(TAG, "Failed");
}
@Override
public void onPrepareLoad (final Drawable drawable) {
someTouchImageView.setImageDrawable (drawable);
}
});
Run Code Online (Sandbox Code Playgroud)
希望这有助于像我们这样的其他人使用TouchImageView和Picasso;)
| 归档时间: |
|
| 查看次数: |
4075 次 |
| 最近记录: |