简体   繁体   中英

Android: How to give Height and width to gif image in picasso

Hi I'm using the picasso for loading gif image (I'm loading this gif image just before loading the actual image or error in the image URL)

Code:

/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);

Used image 图片

For this code, I want to give height and width to gif image. Can any one help to achieve this

您必须使用.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);

尝试resize()方法。

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM