相关疑难解决方法(0)

毕加索没有加载图像

这是毕加索的代码:

ImageView img = (ImageView)findViewById(R.id.product_image);
    Picasso.with(this)
    .load(_url)
    .fit()
    .into(img, new Callback() {

        @Override
        public void onSuccess() {


        }

        @Override
        public void onError() {


        }
    });
Run Code Online (Sandbox Code Playgroud)

这是_url的价值:http: //kiagallery.ir/Images/Upload/Collection%20101/Spring%20101/d4a03b66dc7b46c694615c549b78b2e9.jpg

这是xml:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<ImageView 
    android:id="@+id/product_image"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />

<TextView 
    android:id="@+id/product_name"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textSize="13sp"
    android:layout_below="@id/product_image"/>

<TextView
    android:id="@+id/product_price"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textSize="13sp"
    android:layout_below="@id/product_name"/>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

你可以看到图像可以通过浏览器访问,但毕加索无法加载它,我已经检查了onError函数,它从未被调用,我很安静地丢失在这里,任何帮助将不胜感激.

编辑:当我给imageview的宽度和高度固定值像200dp时,它加载图像,但当我将其更改为wrap_content时,它不显示图像.

android imageview picasso

14
推荐指数
2
解决办法
2万
查看次数

标签 统计

android ×1

imageview ×1

picasso ×1