草庐IT

android - 使用 Picasso 和 Robolectric 的虚假测试失败

我今天刚刚升级到Robolectric2.1.1并集成了Picasso。我现在有两个随机失败的测试用例(其中一个fragment甚至不使用Picasso)。如果我继续运行测试,通常一切都会通过(可能需要尝试几次)。测试@BeforepublicvoidsetUp()throwsException{detailActivity=Robolectric.buildActivity(ActivityUnderTest.class).withIntent(createIntent()).create().start().resume().get();//Note:Theothertestcas

android - 在 Picasso.load() 之后更改 recyclerview 中的 ImageView 大小?

我有:带有GridLayoutManager的回收ViewGriditemlayoutwithImageViewinit(withheightwrap_contentandwidthmatch_parent)wrappedinaFramelayout,所以图像是bottom|center_horizo​​ntal对齐的Picasso从网络异步加载图像到ImageView现状:图像加载到imageView中,但imageview的大小是回收的网格项目的imageview的大小。我想实现的目标:将图像加载到ImageView后,在运行时调整ImageView的大小(重绘)。我尝试过的:no

android - picasso 的图像方向发生了变化

我正在创建一个android应用程序,我在其中使用Picassojar从JSON加载图像,这里有些图像以错误的方向显示。不是每个图像,但只有一些。你能帮我解决这个问题吗:Picasso.with(Sell_Preview_Activity.this).load(Httppost_Links.imagePath+ConstantVariables.sellDetails_stringURL).networkPolicy(NetworkPolicy.NO_CACHE).memoryPolicy(MemoryPolicy.NO_CACHE).into(view_imageView,newco

android - 网络连接关闭时,适用于 Android 的 Picasso 库是否处理图像加载?

我正在开发一个使用Picassolibrary的应用程序用于在我的ViewPager和其他ImageViews中加载图像。所以我想知道如果网络连接关闭会发生什么。该库是自行处理还是我必须在将图像加载到View之前检查网络连接?我的代码:Picassopicasso=Picasso.with(getActivity());picasso.setDebugging(true);picasso.load(downloadPath+imgDetailPhoto).placeholder(R.drawable.no_image).error(android.R.drawable.stat_not

Android 在 ListView 中使用 Picasso 和 TextDrawable

我有一个用户图像的ListView。有些用户有头像,我用Picasso加载图像。如果用户没有图像,使用TextDrawable我在我的ListView适配器中设置了他的图像,如下所示。if(picture!=null){UriimageUri=Uri.parse(picture);Picasso.with(holder.pic.getContext()).load(imageUri.toString()).fit().centerCrop().into(holder.pic);}else{ColorGeneratorgenerator=ColorGenerator.MATERIAL;/

java - 如何使用 Picasso 指定多个后备图像?

Picassolibrary允许人们轻松加载图像,例如:Picasso.with(context).load(url).into(imageview);API还允许指定错误图像。但是如果我想让库在放弃并显示错误图像之前先尝试三个或四个不同的URL,我该怎么办?理想情况下,将按顺序尝试这些图像,如果未加载前一个图像,则回退到下一个图像。 最佳答案 原生没有此类功能的API。但是用一些巧妙的编码Picasso.Target您可以轻松实现此类功能。我将在此处添加一个未经黑客测试的快速代码,您应该可以大致了解要查找的内容。您必须进行测试,也

Java OutOfMemoryError 使用 Picasso 图像

我正在尝试将图像加载到ImageView中并收到OutOfMemoryError。图像根据ViewPager中的特定View动态显示。但是,在我继续滚动浏览ViewPager之后,图像最终无法加载并导致OutOfMemoryError。请注意,我在ViewPager中有4个View,应用程序似乎在View2上崩溃。我猜图像的尺寸太大了,但我的印象是Picasso会相应地处理:picasso代码:Picasso.with(getActivity()).load(mImageURL).fit().memoryPolicy(MemoryPolicy.NO_CACHE,MemoryPolicy

android - 如何获取 picasso 的最新版本代码

我想在我的项目中实现Picasso,但是当我尝试在我的项目中实现Picasso时。我访问了他们的网站以获得依赖性。但是他们删除了最新版本号,所以我找不到Picasso的最新版本号。如果有人对这个版本发表评论我会很高兴网站链接(ClickHere)提前致谢 最佳答案 最新版本是2.71828implementation'com.squareup.picasso:picasso:2.71828'在他们的github上可用https://github.com/square/picasso 关于

android - TouchImageView 缩放缩放到 picasso 框架

我使用UniversalImageLoader库来加载一组图像,并使用TouchImageView来允许缩放。我决定用picasso替换UniversalImageLoader。一切正常,除了现在图像围绕比图像稍大的帧缩放。@OverridepublicObjectinstantiateItem(ViewGroupview,intposition){ViewimageLayout=inflater.inflate(R.layout.item_pager_image,view,false);assertimageLayout!=null;TouchImageViewimageView=(

android - 设置最大宽度以使用 Picasso 加载图像

我的Activity中有一个固定的header,我需要将图像动态加载到其中。我需要这些图像来完全填充此标题,并保持宽度和高度比例。如果我之前加载图像,我会得到OutOfMemoryException。如果我使用picasso的fit()方法,该区域将出现空白。如果我像StackOverflow中的一些人所建议的那样使用Transformation,我也会得到OutOfMemoryException。我该如何解决这个问题?headerXML:使用以下代码以编程方式将图像添加到ViewFlipper:finalImageViewimageView=newImageView(Suggesti