2016-03-05 60 views
1

我的用例是从URL加载图片,并且我使用的是毕加索,通过以下方式获得该图片。毕加索未加载图片,并且没有记录错误

ll = (LinearLayout) findViewById(R.id.tasklayout); 
    ImageView imageView = new ImageView(this); 
    Picasso.with(this).load(taskFieldDao.data).into(imageView); 
    ll.addView(imageView, new LinearLayout.LayoutParams(800, 800)); 

我看到的是一个没有图像的800 * 800空格。看着日志,似乎没有任何问题。至少毕加索没有记录任何东西。

+0

尝试在打开图片网址浏览器 –

+0

是的,它的工作原理。它与ios和android中使用的网址相同。 iOS能够从url中获取图片 – user462455

+0

我现在也面临着与Glide同样的问题。它不是从登录中加载图像响应 –

回答

0

我用按钮点击复制你的问题,它工作。您可以也检查你的道路是正确的

downloadButton = (Button)findViewById(R.id.download_button); 

    downloadButton.setOnClickListener(new View.OnClickListener() { 
     @Override 
     public void onClick(View v) {     

      RelativeLayout relativeLayout = (RelativeLayout) findViewById(R.id.relative); 
      ImageView imageView = new ImageView(PicassoDownloadActivity.this); 
      Picasso.with(PicassoDownloadActivity.this).load(Helper.imageDownloadPath).into(imageView); 
      relativeLayout.addView(imageView, new LinearLayout.LayoutParams(800, 800)); 
     } 
    }); 
出问题的时候,我建议做这样的事情
0

毕加索通常不会给出错误:

ll = (LinearLayout) findViewById(R.id.tasklayout); 
final ImageView imageView = new ImageView(this); 
Picasso.with(this).load(taskFieldDao.data).into(imageView, new Callback() { 

    @Override 
    public void onSuccess() { 
     ll.addView(imageView, new LinearLayout.LayoutParams(800, 800)); 
    } 

    @Override 
    public void onError() { 
     Log.e("Picasso","Image load failed); 
    } 
});