如果我不使用Picasso并仅使用BitmapFactory.decodeFile,我的ImageView将加载图像。将其更改为使用毕加索时,图像不会显示。即使我把Callback看成是否能够成功和失败,但是没有一个能够击中。
public override View GetView(int position, View convertView, ViewGroup parent) {
View layout = convertView;
ImageView imageView;
var page = (BasePage)Pages [position];
if (layout == null) {
layout = LayoutInflater.From (Context).Inflate (Resource.Layout.view_page_thumbnail, null);
imageView = layout.FindViewById<ImageView> (Resource.Id.imgThumbnail);
} else {
imageView = layout.FindViewById<ImageView> (Resource.Id.imgThumbnail);
var bmpDrawable = (BitmapDrawable) imageView.Drawable;
if (bmpDrawable != null && bmpDrawable.Bitmap != null) {
bmpDrawable.Bitmap.Recycle ();
bmpDrawable.Bitmap.Dispose ();
bmpDrawable.Dispose();
bmpDrawable = null;
}
}
imageView.SetImageBitmap (null);
Picasso.With (Application.Context)
.Load (Android.Net.Uri.Parse("file://" + page.FileLocation))
.CenterInside ()
.Fit ()
.Into (imageView, ()=>{
var a = 0;
var b= 0;
},
()=>{
var c=0;
var d=0;
}
);
imageView.Tag = page.FileLocation;
layout.Tag = "Image" + position;
return layout;
答案 0 :(得分:0)
替换它:
.Load (Android.Net.Uri.Parse("file://" + page.FileLocation))
使用以下代码:
.Load (new File(page.FileLocation))
答案 1 :(得分:0)
试试这个
picass.with(Context).load(url).into(ImageView).