Displayimageoptions options; //Displayimageoptions is the class for setting up picture display
Create displayimageoptions using Displayimageoptions.builder ()
options = new Displayimageoptions.builder ()
. Showstubimage (R.drawable.ic_stub)//Set picture to display during picture download
. Showimageforemptyuri (R.drawable.ic_empty)//Set picture to display when the image URI is empty or wrong
. Showimageonfail (R.drawable.ic_error)//Set Picture of error display during picture loading or decoding
. Cacheinmemory (TRUE)//Set whether the downloaded picture is slow to exist in memory
. Cacheondisc (TRUE)//Set whether the downloaded picture is slow to exist on the SD card
. Displayer (New Roundedbitmapdisplayer (20))//Set rounded picture
. build (); To create a configured Displayimageoption object
Private Imageloadinglistener Animatefirstlistener = new Animatefirstdisplaylistener ();
/**
* Image loading first time display listener
* @author Administrator
*
*/
private static class Animatefirstdisplaylistener extends Simpleimageloadinglistener {
Static final list<string> displayedimages = collections.synchronizedlist (New linkedlist<string> ());
@Override
public void Onloadingcomplete (String imageuri, view view, Bitmap loadedimage) {
if (loadedimage! = null) {
ImageView ImageView = (ImageView) view;
Whether to display the first time
Boolean firstdisplay =!displayedimages.contains (Imageuri);
if (Firstdisplay) {
Picture fade-in effect
Fadeinbitmapdisplayer.animate (ImageView, 500);
Displayedimages.add (Imageuri);
}
}
}
}
/**
* Show Pictures
* Parameter 1: Image URL
* Parameter 2: control to display pictures
* Parameter 3: Display the picture's settings
* Parameter 4: Listener
*/
Imageloader.displayimage (Imageurls[position], holder.image, Options, Animatefirstlistener);
For more information, refer to the blog:
http://blog.csdn.net/wwj_748/article/details/10079311
The use of frame Imageloader for Android picture cache