3
我用Square Picasso這樣的:如何將加載指標添加到Android Picasso?
Picasso.with(context)
.load(url)
.centerCrop()
.fit()
.into(imageView);
我想有一個旋轉負載指示而畢加索加載圖像。我試過的解決方案張貼在這裏:
Animated loading image in picasso
Show an "Loading..." image while background loading of image with Picasso
我創建了一個動畫:
<?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
裏面調用:
Picasso.with(context)
.load(your_path)
.error(R.drawable.ic_error)
.placeholder(R.drawable.progress_animation)
.into(image_view);
我問題在於在動畫沒有運行。此外,它不是圖像中間的小型加載指示器,而是將加載圖像拉伸到圖像的尺寸。
如何向Android Picasso添加加載指示器?
使用不同形式的動畫繪製的,如[一個'AnimationDrawable'](http://developer.android.com/guide/topics/graphics/drawable- animation.html)。 「它也不是圖像中間的一個小小的加載指示器,而是加載圖像被拉伸到圖像的尺寸」 - 您需要設置drawable以根據需要填充。這可能是'animated-rotate'的屬性(我還沒有見過或使用過);對於'AnimationDrawable',你提供了幀,所以會把填充放在幀圖像本身。 – CommonsWare
您能否在回答中發佈示例? – confile