您的位置:首页 > 理论基础 > 计算机网络

Android 网络图片加载之cude 框架

2015-04-15 09:03 344 查看
偶然发现了这个框架,阿里图片加载用的这个框架。非常简单操作步骤。

1.首先下载软件包,直接搜Cube ImageLoader 这个。

2.加入jar文件

3.使用前的配置:

public class CubeApplication extends Application {

@Override
public void onCreate() {
super.onCreate();

// other code
// ..

Cube.onCreate(this);
}

@Override
public void onTerminate() {
super.onTerminate();

// other code
// ...

Cube.onTerminate();
}
}


1.首先,创建一个ImageLoader:

Context context;
ImageLoader imageLoader = ImageLoaderFatory.create(context);


2.用findViewById()找到要加载图片的ImageView:

CubeImageView imageView = (CubeImageView) view.findViewById(R.id.iv_item_image_list_big);


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >

<!-- 用定制的CubeImageView -->
<in.srain.cube.image.CubeImageView
android:id="@+id/iv_item_image_list_big"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitCenter" />

</LinearLayout>


3.加载图片。就一句代码:

imageView.loadImage(imageLoader, url);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: