使用ImageLoader实例 进行加载图片
来源:互联网 发布:php 微信开发 编辑:程序博客网 时间:2024/06/15 22:51
使用ImageLoader实例 进行加载图片,效果图:
结构图:
activity.xml:
<RelativeLayout 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:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.example.day8imageloader.MainActivity" > <ImageView android:id="@+id/iv" android:layout_width="wrap_content" android:layout_height="wrap_content"/></RelativeLayout>
MainActivity.java:
import com.nostra13.universalimageloader.core.DisplayImageOptions;import com.nostra13.universalimageloader.core.ImageLoader;import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;import android.app.Activity;import android.os.Bundle;import android.widget.ImageView;public class MainActivity extends Activity { ImageView iv ; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); iv = (ImageView) findViewById(R.id.iv); String path = "http://img.my.csdn.net/uploads/201407/26/1406383290_9329.jpg"; //第一步:使用configs参数对 ImageLoader进行初始化 ImageLoaderConfiguration configs = ImageLoaderConfiguration.createDefault(this); ImageLoader.getInstance().init(configs); //第二部:设置图片的显示参数 Simple:1、简单 2、例子 DisplayImageOptions options = DisplayImageOptions.createSimple(); //第三部:使用ImageLoader实例 进行加载图片 //参数1:图片的地址 //参数2:图片的配置信息 //参数3:加载过程中的监听 //参数1:图片的加载地址 //参数2:图片要加载到的控件 ImageLoader.getInstance().displayImage(path, iv); }}
阅读全文
0 0
- 使用ImageLoader实例 进行加载图片
- 使用ImageLoader进行图片加载
- Android 使用ImageLoader框架进行图片加载
- 使用volley的imageloader加载网络图片实例
- 如何使用imageloader加载图片
- ImageLoader进行图片缓存和加载
- 使用ImageLoader实现图片异步加载
- 使用ImageLoader实现图片异步加载
- 使用ImageLoader实现图片异步加载
- 使用ImageLoader实现图片异步加载
- 使用ImageLoader实现图片异步加载
- 使用ImageLoader实现图片异步加载
- 使用Imageloader异步加载网络图片
- 使用ImageLoader实现图片异步加载
- 使用Imageloader加载Bmob上的图片
- 异步加载图片框架ImageLoader的使用
- 使用imageloader加载图片及缩放策略
- Android 使用imageLoader来加载显示图片
- Memcached (简介及安装)--学习笔记(一)
- 习题 5.11 一个球从100m高度自由落下,每次落地后反跳回原高度的一半,再落下,再反弹。求它在第10次落地时,共经过多少米,第10次反弹多高。
- 古文觀止卷八_圬者王承福傳_韓愈
- 已知前序遍历和中序遍历的结果求后序遍历
- js反转字符串方法
- 使用ImageLoader实例 进行加载图片
- 难忘的JS传参问题
- 用二维数组写的简单的推箱子,一个人,两个箱子,两个圈的情况。。
- HDU2643 Rank 第二类斯特林数
- permutation
- jsp基础—1
- java System类
- Java中的泛型
- 可变参列表