草庐IT

android - 我可以将 Picasso 的图片加载到操作栏吗?

我一直在使用Picasso广泛地通过互联网检索图像到我的应用程序。现在,我遇到了需要将小图像检索到操作栏的情况(如标题文本旁边的Logo)。Picasso可以这样做吗?如果是这样,我该怎么做? 最佳答案 我找到了一个解决方案,它使用Picasso的Target类并且不需要自定义操作栏。finalActionBarab=getSupportActionBar();Picasso.with(this).load(imageURL).into(newTarget(){@OverridepublicvoidonBitmapLoaded(Bi

android在 picasso 加载后获取可绘制图像

我正在使用Picasso库从url加载图像。我使用的代码如下。Picasso.with(getContext()).load(url).placeholder(R.drawable.placeholder).error(R.drawable.placeholder).into(imageView);我想做的是获取从url加载的图像。我用过Drawableimage=imageView.getDrawable();但是,这将始终返回占位符图像而不是从url加载的图像。你们有什么想法吗?我应该如何访问刚刚从url加载的可绘制图像。提前致谢。 最佳答案

android - 使用 Picasso 时如何访问 Drawable?

我正在使用Picasso框架来处理我的Android应用程序中的图像加载。加载图像后,我需要访问Drawable以应用一些mask操作。问题是Picasso将Drawable转换为PicassoDrawable,简单地转换回Drawable是行不通的。这是我的代码:Picasso.with(mContext).load(image.getPath()).into(mImageView,newCallback(){@OverridepublicvoidonSuccess(){Util.applyMask(imageView);}@OverridepublicvoidonError(){}

android - Picasso 不支持下载使用 https 协议(protocol)的图片吗

您好,我正在使用Picasso库从URL下载图像。网址:https://fbcdn-profile-a.akamaihd.net/hprofile-ak-prn2/t1.0-1/s200x200/1472865_191408954385576_14109897_n.jpgURL使用的是https协议(protocol),我这里用Picasso下载https协议(protocol)的图片是行不通的。它不支持下载使用https协议(protocol)的图片吗,只有我使用http协议(protocol)才对我有用?这里我试图获取使用https协议(protocol)的位图com.square

Android Picasso 配置 LruCache 大小

我在我的项目中使用了流行的Picasso,但我已经倾倒了堆,它看起来像这样。现在昨天它给了我48M用于Picasso中使用的LruCache。如何指定它的大小?Note:myloadedimagesareapparentlylarge.如果有人想出了fit()或centerCrop(),我读过这些函数可以减小图像大小,对吧?但有时我必须在ListView中以完整View显示小图像。现在,这些函数是否缓存缩小后的图像? 最佳答案 默认情况下,Picasso将1/7的可用堆用于其LRU。这是一个“快乐”分数,在所有设备上都能很好地运行。

android - picasso 图书馆 - 内存不足

我在我的应用程序中使用Picasso库最新版本2.4.0来下载和缓存图像。大约有25-30张图像,每张大小为300KB-400KB。我认为这绝不是一件大事或一件沉重的事情。尽管应用程序运行良好,但我的logcat中的内存分配不足。谁能解释为什么会这样?在GridView适配器中加载图像的代码:Picasso.with(mContext).load(getUrl()).placeholder(R.drawable.placeholder).into(viewholder.image);这是我的Logcat输出:I/dalvikvm-heap(11142):Growheap(fragcas

android - picasso 没有加载图像

这是picasso的代码:ImageViewimg=(ImageView)findViewById(R.id.product_image);Picasso.with(this).load(_url).fit().into(img,newCallback(){@OverridepublicvoidonSuccess(){}@OverridepublicvoidonError(){}});这是_url的值:http://kiagallery.ir/Images/Upload/Collection%20101/Spring%20101/d4a03b66dc7b46c694615c549b78

android - 从 picasso 获取图像uri?

我有一个相当大的图像URL列表,我正在使用这些URL加载一个使用Picasso的ViewPager。我需要能够通过Intent为这些图像提供共享功能(最终通过ShareActionProvider共享)。据我所知,Picasso并不是真正为开箱即用地处理这类事情而构建的,尽管它提供了所有必要的工具来做到这一点。我在研究之前的计划是创建一个简单的LruCache,它使用url作为键和位图值。此缓存将通过Picasso的Target接口(interface)在onBitmapLoaded中进行。每当我想分享一张图片时,我都会检查缓存中的位图。如果它不在那里,我会和Picasso一起去取。既

android - picasso java.lang.IllegalStateException : Method call should not happen from the main thread

我正在尝试使用Picasso从URL获取三个Bitmap图像publicvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState);setContentView(R.layout.tab2);Drawabled1=newBitmapDrawable(Picasso.with(Tab2.this).load(zestimateImg1).get());}使用此代码我得到了FATALEXCEPTION。我怀疑这与应该在AsyncTask中完成这一事实有关,但我无法让它工作。如果可以避免使用它,我想在不使

android - Picasso 从文件系统加载图像

我可以使用Picasso库从文件系统加载图像吗?我正在使用startActivityForResult让用户从他的画廊中挑选一张照片,然后想要显示所选图像。我已经有工作代码来获取图像文件系统Uri,但无法让Picasso.load()方法工作。 最佳答案 当然可以。它实际上非常简单:Filef=newFile("path-to-file/file.png");或Filef=newFile(uri);Picasso.get().load(f).into(imageView);还有Picasso.get().load(uri).into