Android-smart-image-view加载网络图片
2014-05-30 15:30
721 查看
界面效果
应用的权限
<uses-permission android:name="android.permission.INTERNET"/>
布局文件
核心文件
注:使用前提,需要加入Android-smart-image-view框架
下载地址:
应用的权限
<uses-permission android:name="android.permission.INTERNET"/>
布局文件
<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="100" /> <EditText android:id="@+id/et_path" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="请输入图片地址" android:singleLine="true" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:onClick="checkImage" android:text="@string/bt_catchImage" /> </LinearLayout>
核心文件
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; @Override protected 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); // 加载的路径|如果没有加载到显示的内容|等待加载的图片 siv.setImageUrl(et_path.getText().toString().trim(), R.drawable.ic_launcher, R.drawable.ic_launcher); } }
注:使用前提,需要加入Android-smart-image-view框架
下载地址:
相关文章推荐
- android加载网络上的图片-使用SmartImageView
- Android(java)学习笔记204:自定义SmartImageView(继承自ImageView,扩展功能为自动获取网络路径图片)
- Android SmartImageView的使用(堪与ImageLoader加载图片媲美)
- 在android中使用ImageLoder加载网络图片时,将图片设置为ImageView的背景
- 【Android自定义View实战】之自定义圆形头像CircleImageView支持加载网络图片
- Android之使用SmartImageView加载图片
- Androidx学习笔记(31)--- android-smart-image-view查看网络图片
- android ImageView网络图片加载、动态设置尺寸、圆角..
- SmartImageView重新实现网络图片的加载
- RxAndroid和RxJava结合OkGo示例请求网络图片加载到不同ImageView
- SmartImageView重新实现网络图片的加载
- Android ImageView如何加载网络图片资源
- Android smartimageview网络图片查看器
- 用Android Smart Image View做的一个网络图片浏览的Demo
- android开源项目SmartImageView设置网络图片url时抛出java.io.FileNotFoundException
- Android ImageView如何加载网络图片资源
- android控件ImageView加载sdcard卡,网络及res中的图片
- 一句代码加载网络图片到ImageView——Android Picasso
- Android核心基础-7.Android 网络通信-3.SmartImageView请求网络图片
- android使用ImageView加载本地SdCard图片和加载网络图片