1

I'm using Universal Image Loader to load a previous image before the official one in my catalog.

But as a request from my boss, I have to insert a native ProgressBar before the loading of all official images in the app.

Universal Image Loader provides in the displayImage() method, a way using a SimpleImageLoadingListener to do that. That's ok and works fine. But I had to call it all over my app.

Is there a way I can draw(copy) the native ProgressBar image and make it rotate as an animation? If this is possible as a 'drawable', I could just change one line in my UIL coonfigs:

IMAGE_OPTIONS = new DisplayImageOptions.Builder() //
        .showImageOnLoading(R.drawable.mynativeandanimatedprogressbar) 
                ETC ETC ETC

Thanks in advance, I really appreciate any help.

bye

4

1 回答 1

0

//你可以这样做

imageLoader.displayImage(IMAGE_DOWNLOAD_URL,  holder.image, options,new SimpleImageLoadingListener() {

    @Override
    public void onLoadingStarted(String imageUri, View view) {
        ((ImageView) view).setBackgroundResource(R.drawable.my_image_progress);
         AnimationDrawable frameAnimation = (AnimationDrawable)((ImageView) view).getBackground();

         // Start the animation (looped playback by default).
         frameAnimation.start();
    }
    @Override
    public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
        ((ImageView) view).setImageBitmap(loadedImage);
    }

});

// my_image_progress.xml 放入

<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
                android:oneshot="false" >
    <item android:drawable="@drawable/logo_n" android:duration="500" />
    <item android:drawable="@drawable/logo_l" android:duration="500" />
    <item android:drawable="@drawable/logo_d" android:duration="500" />

</animation-list>
于 2014-04-14T14:15:45.910 回答