【问题标题】:Android: How to give Height and width to gif image in picassoAndroid:如何在毕加索中为 gif 图像提供高度和宽度
【发布时间】:2016-01-05 20:16:35
【问题描述】:

您好,我正在使用 picasso 加载 gif 图像(我在加载实际图像之前加载此 gif 图像或图像 URL 中的错误)

代码:

/res/drawable/progress_animation.xml

<?xml version="1.0" encoding="utf-8"?>
<animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"
    android:drawable="@drawable/progress_image"
    android:pivotX="50%"
    android:pivotY="50%" />

Picasso.with(context).load("google.com").error(R.drawable.progress_animation).placeholder(R.drawable.progress_animation).into(holder.imageURL);

使用过的图片

对于这段代码,我想为 gif 图像提供高度和宽度。任何人都可以帮助实现这一目标

【问题讨论】:

    标签: android height width picasso


    【解决方案1】:

    你必须使用.resize(width, height),例如:

    Picasso.with(context).load("google.com").error(R.drawable.progress_animation).placeholder(R.drawable.progress_animation).resize(30, 30).into(holder.imageURL);
    

    【讨论】:

      【解决方案2】:

      试试resize()的方法

      Picasso.with(context).load("google.com").resize(50, 50).error(R.drawable.progress_animation).placeholder(R.drawable.progress_animation).into(holder.imageURL);
      

      【讨论】:

        猜你喜欢
        • 2014-10-20
        • 2021-10-01
        • 1970-01-01
        • 1970-01-01
        • 2015-09-30
        • 1970-01-01
        • 2014-03-20
        • 2014-01-16
        相关资源
        最近更新 更多