Load a network picture using Android-smart-image-view

Source: Internet
Author: User

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

:



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.