无法在Android中下载图片

时间:2018-02-25 11:44:30

标签: java android android-glide

在我的Asynctask的onPostExecute方法

LinearLayout ll=(LinearLayout) findViewById(R.id.mylinlay);
TextView tv=new TextView(Download_İmage.this);
tv.setText("try");
ImageView tempimg=new ImageView(Download_İmage.this);
Glide.with(getApplicationContext()).load("http://inthecheesefactory.com/uploads/source/glidepicasso/cover.jpg").into(tempimg);
tv.setCompoundDrawables(tempimg.getDrawable(),null,null,null);
ll.addView(tv);

这里动态地将所有textview添加到linearlayout。带文本的所有textview看起来都很好,并尝试使用现有的drawable图像工作。但是当我尝试通过毕加索下载图像或滑动它不工作时。所以我无法获得远程图像。< / p>

com.bumptech.glide.Glide锁定验证失败,运行速度较慢。 对于picasso也有这条消息和相同的消息。我使用调试选项检查但是该图像可绘制为空。

1 个答案:

答案 0 :(得分:0)

你应该像这样滑行。

from rest_framework import generics

from .serializers import CartItemSerializer


class CartAPIView(generics.ListAPIView):
    serializer_class = CartItemSerializer

    def get_queryset(self)
        return CartItem.objects.filter(user=self.request.user)