In the development we often use the image download function, but we can be on GitHub on some of the more good plug-ins, here is a plug-in called Smartimageview.
Here is its address Https://github.com/loopj/android-smart-image-view
How to use
PackageXidian.dy.com.chujia;ImportAndroid.os.Bundle;Importandroid.support.v7.app.AppCompatActivity;ImportAndroid.view.View;ImportAndroid.widget.Button;ImportCom.loopj.android.image.SmartImageView; Public classMainactivityextendsappcompatactivity {@Overrideprotected voidonCreate (Bundle savedinstancestate) {Super. OnCreate (savedinstancestate); Setcontentview (R.layout.activity_main); Button btn=(Button) Findviewbyid (R.ID.BTN); if(BTN! =NULL) Btn.setonclicklistener (NewMylister ()); } classMylisterImplementsview.onclicklistener{@Override Public voidOnClick (View v) {String URL= "Http://192.168.0.109/dog.jpg"; Smartimageview Siv=(Smartimageview) Findviewbyid (r.id.img); if(Siv! =NULL) siv.setimageurl (URL); } }}
Layout file
<?XML version= "1.0" encoding= "Utf-8"?><LinearLayoutxmlns:android= "Http://schemas.android.com/apk/res/android"Xmlns:tools= "Http://schemas.android.com/tools"Android:layout_width= "Match_parent"Android:layout_height= "Match_parent"android:orientation= "vertical"Tools:context= "Xidian.dy.com.chujia.MainActivity"> <ButtonAndroid:id= "@+id/btn"Android:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"Android:text= "@string/delete" /> <Com.loopj.android.image.SmartImageViewAndroid:id= "@+id/img"Android:layout_width= "100DP"Android:layout_height= "100DP"android:src= "@drawable/dog1" /></LinearLayout>
This can be compared with your own hand-written picture loading.
Http://www.cnblogs.com/xidongyu/p/5612545.html
The use of Android Imgview plugin