本文介绍了如何在毕加索提高速度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Picasso加载图像,缩放并设置为listview项目.有我的代码:

I'm using Picasso to load images, scale and set to listview item. There is my code:

Picasso.with(getActivity()).load(builder.toString())
                            .config(Bitmap.Config.RGB_565)
                            .into(new Target() {
                                @Override
                                public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
                                    int width = Double.valueOf(bitmap.getWidth() * 0.75).intValue();
                                    int height = bitmap.getHeight();
                                    Bitmap newBitmap = Bitmap.createBitmap(bitmap, 0, 0, width, height);
                                    imageView.setImageBitmap(newBitmap);

                                }

                                @Override
                                public void onBitmapFailed(Drawable errorDrawable) {

                                }

                                @Override
                                public void onPrepareLoad(Drawable placeHolderDrawable) {

                                }
                    });

当我在.into()方法中创建new Target()对象时出现了问题,在此之前,加载的图像的速度非常快.我以为到底是什么因素拖慢了我的工作,以及如何纠正它?规模内存昂贵吗?还是因为完全使用new Target()?

The problem appears when I made new Target() object in the .into() method, before that the speed of loaded images were very fast.I thought what exactly slowed down my work and how to correct it? Is scale memory-expensive or this is because of new Target() implementation at all?

谁遇到这个问题?怎么解决呢?

Who faced with this problem? How to solve that?

推荐答案

您可以使用Fresco进行图像加载..即使是Facebook,也可以使用Fresco进行缩放;您可以使用android:scaleType.its非常有用.了解壁画 http://frescolib.org/docs/index.html

You can use Fresco for image loading..even facebook using same and for scaling you can use android:scaleType.its very usefullRead about Frescohttp://frescolib.org/docs/index.html

这篇关于如何在毕加索提高速度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-14 11:49