标签: picasso

Picasso v/s Imageloader v/s Fresco vs Glide

发现:

  1. Picasso v/s ImageLoader的区别在这里......
  2. 关于图书馆GLIDE的信息在这里......
  3. 现在最近Facebook发布了名为Fresco的新图像库

问题:

  1. Picasso v/s Imageloader v/s Fresco有什么区别
  2. 我们什么时候可以使用Glide
  3. 哪个是最好的库.
  4. 如果每个图书馆都有自己的意义,那么它们是什么?

android universal-image-loader picasso fresco android-glide

336
推荐指数
6
解决办法
14万
查看次数

使用Picasso将图像调整为全宽和固定高度

我有一个垂直的LinearLayout,其中一个项目是ImageView使用Picasso加载的.我需要将图像的宽度提升到整个设备宽度,并显示图像的中心部分被固定高度(150dp)裁剪.我目前有以下代码:

Picasso.with(getActivity()) 
    .load(imageUrl) 
    .placeholder(R.drawable.placeholder) 
    .error(R.drawable.error) 
    .resize(screenWidth, imageHeight)
    .centerInside() 
    .into(imageView);
Run Code Online (Sandbox Code Playgroud)

我应该把哪个值成screenWidthimageHeight(= 150dp)?

java android image-resizing imageview picasso

163
推荐指数
2
解决办法
9万
查看次数

在第一次加载时未调用的Target对象的onBitmapLoaded

在我的功能:

public void getPointMarkerFromUrl(final String url, final OnBitmapDescriptorRetrievedListener listener) {
final int maxSize = context.getResources().getDimensionPixelSize(R.dimen.icon_max_size);
Target t = new Target() {
  @Override
  public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
    if (bitmap != null)
      listener.bitmapRetrieved(getBitmapDescriptorInCache(url, bitmap));
    else
      loadDefaultMarker(listener);
  }

  @Override
  public void onBitmapFailed(Drawable errorDrawable) {
    loadDefaultMarker(listener);
  }

  @Override
  public void onPrepareLoad(Drawable placeHolderDrawable) {
  }
};

Picasso.with(context)
    .load(url)
    .resize(maxSize, maxSize)
    .into(t);
}
Run Code Online (Sandbox Code Playgroud)

我第一次加载图片时从不调用onBitmapLoaded().我已经阅读了一些话题,如https://github.com/square/picasso/issues/39,建议使用fetch(Target t)方法(这似乎是弱引用的问题......),但是这个函数在毕加索的最后一个版本(2.3.2)中没有.我只有一个fetch()方法,但我不能同时使用(mytarget)

你能解释一下如何使用fetch()和自定义Target吗?谢谢.

文件:http://square.github.io/picasso/javadoc/com/squareup/picasso/RequestCreator.html#fetch--

picasso

122
推荐指数
6
解决办法
4万
查看次数

如何在Picasso中使用磁盘缓存?

我正在使用Picasso在我的Android应用程序中显示图像:

/**
* load image.This is within a activity so this context is activity
*/
public void loadImage (){
    Picasso picasso = Picasso.with(this); 
    picasso.setDebugging(true);
    picasso.load(quiz.getImageUrl()).into(quizImage);
}
Run Code Online (Sandbox Code Playgroud)

我已启用调试,它始终显示红色和绿色.但从不显示黄色

现在,如果我下次加载相同的图像并且互联网不可用,则不会加载图像.

问题:

  1. 它没有本地磁盘缓存吗?
  2. 如何启用磁盘缓存,因为我将多次使用相同的图像.
  3. 我需要为android清单文件添加一些磁盘权限吗?

android caching image picasso

116
推荐指数
5
解决办法
10万
查看次数

如何在回收器视图适配器中获取上下文

我正在尝试使用picasso库来加载url到imageView,但我无法context正确使用picasso库.

public class FeedAdapter extends RecyclerView.Adapter<FeedAdapter.ViewHolder> {
    private List<Post> mDataset;



    // Provide a reference to the views for each data item
    // Complex data items may need more than one view per item, and
    // you provide access to all the views for a data item in a view holder
    public class ViewHolder extends RecyclerView.ViewHolder {
        // each data item is just a string in this case
        public TextView txtHeader;
        public ImageView pub_image;
        public ViewHolder(View v) {
            super(v); …
Run Code Online (Sandbox Code Playgroud)

java android android-context picasso android-recyclerview

116
推荐指数
9
解决办法
8万
查看次数

在毕加索的动画加载图像

我有以下代码在Picasso中加载图像,使用drawable在占用图像下载时显示占位符.我想要的是一个动画旋转进度条样式微调器,在图像加载时围绕和周围动画,就像我在大多数专业应用程序中看到的那样.毕加索似乎不支持这一点,只有静态图像可绘制.有没有办法让它与毕加索合作,还是我必须做一些与众不同的事情?

Picasso.with(context).load(url)             
                    .placeholder(R.drawable.loading)
                    .error(R.drawable.image_download_error)
                    .into(view);
Run Code Online (Sandbox Code Playgroud)

android picasso

104
推荐指数
3
解决办法
7万
查看次数

android:用毕加索创建圆形图像

问题已被提出,并且我正在使用的毕加索版本有一个承诺:如何使用Picasso将圆形位图发送到ImageView?我是毕加索的新手,我唯一使用的是

Picasso.with(context).load(url).resize(w, h).into(imageview);
Run Code Online (Sandbox Code Playgroud)

我已经找到https://gist.github.com/julianshen/5829333但我不知道如何以非尴尬的方式将它与上面的行结合起来.

android bitmap imageview picasso

101
推荐指数
6
解决办法
8万
查看次数

适用于Android的本地图像缓存解决方案:Square Picasso,Universal Image Loader,Glide,Fresco?

我正在寻找Android中的异步图像加载和缓存库.我打算使用Picasso,但我发现Universal Image Loader在GitHub上更受欢迎.有谁知道这两个图书馆?优点和缺点的摘要会很棒.

(我的所有图像都在本地磁盘上,因此我不需要联网,因此我认为Volley不合适)

android universal-image-loader picasso fresco android-glide

88
推荐指数
4
解决办法
7万
查看次数

如何收听Picasso(Android)加载完整事件?

有没有办法在使用建筑师时听毕加索的事件,如:

Picasso.with(getContext()).load(url).into(imageView);

我想打电话requestLayout()invalidate()GridView所以它会适当调整,但我不知道如何设置监听器或回调.

我看到Picasso有错误事件报告,但有成功事件吗?

java android picasso

87
推荐指数
4
解决办法
4万
查看次数

使用Picasso通过Bitmap获取回调

我正在使用Picasso为我的应用下载图像.

我遇到的情况是我需要Bitmap在加载到第一个之前访问第一个ImageView.Downloader.Response该类的存在似乎表明这是可能的,但我找不到任何使用示例.我不想写一堆更多的代码来异步处理这个特殊情况,如果它可以与Picasso一起使用的话.

谁能告诉我怎么做?

android bitmap picasso

81
推荐指数
3
解决办法
9万
查看次数