Interface effect
Permissions for Apps
<uses-permission android:name= "Android.permission.INTERNET"/>
Layout file
< LinearLayout xmlns: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= ". Mainactivity "> <com.loopj.android.image.smartimageview android:id=" @+id/siv "android:layout_width= "Match_parent" android:layout_height= "match_parent" android:layout_weight= "/> <edittext" Android:id= "@+id/et_path" android:layout_width= "match_parent" android:layout_height= "Wrap_content" a ndroid:hint= "Please enter picture address" android:singleline= "true"/> <button android:layout_width= "Wrap_content" android:layout_height= "Wrap_content" android:onclick= "Checkimage" android:text= "@string/bt_catchimage"/& Gt;</linearlayout>
Core Files
Package Com.examp.use_android_smart_image_view;import Com.loopj.android.image.smartimageview;import Android.app.activity;import Android.os.bundle;import Android.view.view;import Android.widget.EditText;public class Mainactivity extends Activity {private EditText et_path;private smartimageview siv; @Overrideprotected void OnCreate ( Bundle savedinstancestate) {super.oncreate (savedinstancestate); Setcontentview (r.layout.activity_main); Et_path = ( EditText) Findviewbyid (R.id.et_path); Et_path.settext ("http://c.hiphotos.baidu.com/image/w%3D310/sign= 1ebfb751a6c27d1ea5263dc52bd4adaf/78310a55b319ebc47dc5736c8026cffc1f171681.jpg ");} public void Checkimage (view view) {Siv = (Smartimageview) Findviewbyid (R.ID.SIV);//path Loaded | If not loaded to the displayed content | Wait for the loaded picture Siv.setimageurl (Et_path.gettext (). toString (). Trim (), r.drawable.ic_launcher, R.drawable.ic_launcher);}}
Note: You need to join the Android-smart-image-view framework to use the premise
: