本文介绍了Android-Picasso仅显示占位符,而不显示URL中的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有此代码
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ImageView image_view = (ImageView)findViewById(R.id.imageView1);
Picasso.with(getApplicationContext()).load("http://nuclearpixel.com/content/icons/2010-02-09_stellar_icons_from_space_from_2005/earth_128.png").placeholder(R.drawable.ic_launcher).noFade().into(image_view);
}
我想从我的imageview中的url查看图像...但是,仅占位符显示的不是图像.可能是什么问题?
And i want to view the image from url in my imageview... however instead of the image only the placeholder shows. What may be the problem?
推荐答案
尝试仅使用picasso.load()而不是Picasso.with()
Try using just picasso.load() instead of Picasso.with()
类似这样的东西:
Picasso.Builder builder = new Picasso.Builder(getApplicationContext());
Picasso picasso = builder.build();
picasso.load("http://nuclearpixel.com/content/icons/2010-02-09_stellar_icons_from_space_from_2005/earth_128.png").placeholder(R.drawable.ic_launcher).noFade().into(image_view);
这篇关于Android-Picasso仅显示占位符,而不显示URL中的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!