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的图像…但是,只有占位符显示而不是图像.可能是什么问题?

最佳答案
尝试使用picasso.load()而不是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中的图像 - 代码日志