Android - picasso仅显示占位符,而不显示URL中的图像

时间:2014-09-11 08:02:27

标签: android android-imageview picasso

我有这段代码

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中查看来自网址的图片...但是只有占位符显示而不是图像。可能是什么问题?

1 个答案:

答案 0 :(得分:2)

尝试使用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);