Android Smart Image View使用方法--从url获取图片或从通讯录获取图片,支持缓存
来源:互联网 发布:密度聚类算法 编辑:程序博客网 时间:2024/05/22 13:26
Android Smart Image View------Load Images from URLs or Android Contacts with Caching
一、下载:http://loopj.com/android-smart-image-view/
解压下载的文件,将 com目录复制你自己的工程src目录下或者也可以将 下载的 jar文件放到你的 libs目录下
注:链接里有使用方法
二、
package com.jiangge.imageviewerusesmartview;import com.loopj.android.image.SmartImageView;import android.os.Bundle;import android.app.Activity;import android.util.Log;import android.view.Menu;import android.view.View;import android.widget.EditText;public class MainActivity extends Activity {SmartImageView mySmartView; EditText it_url;@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);it_url = (EditText) findViewById(R.id.it_path);mySmartView = (SmartImageView) findViewById(R.id.my_smart_image_view);}public void click(View view){mySmartView.setImageUrl(it_url.getText().toString().trim());Log.i("URL", it_url.getText().toString().trim());}}
核心代码:
mySmartView = (SmartImageView) findViewById(R.id.my_smart_image_view);
mySmartView.setImageUrl(it_url.getText().toString().trim());
三、XML文件:
<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/my_smart_image_view" android:layout_weight="1000" android:layout_width="match_parent" android:layout_height="0dp" android:text="@string/hello_world" /> <EditText android:id="@+id/it_path" android:singleLine="true" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="http://g.hiphotos.baidu.com/image/w%3D2048/sign=fa4ce6add31b0ef46ce89f5ee9fc50da/f636afc379310a55ed977077b64543a983261085.jpg" android:hint="图片路径" > </EditText> <Button android:id="@+id/btn" android:onClick="click" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="发送请求" > </Button></LinearLayout>
核心代码:
<com.loopj.android.image.SmartImageView
四、效果图:
解压下载的文件,将 com目录复制你自己的工程src目录下
文档上的使用方法:
- Android Smart Image View使用方法--从url获取图片或从通讯录获取图片,支持缓存
- Android学习(35) -- smart-image-view 获取网络图片
- Android 从相机或相册获取图片
- 从view 获取image
- image从数据库中获取图片方法
- Android 4.4从图库选择图片,获取图片路径并裁剪 获取路径出错 image%
- Android-smart-image-view加载网络图片
- Android--从网络获取图片
- android从本地获取图片
- android从internet获取图片
- android 从网络获取图片
- android从服务器获取图片
- android 从图片获取二维码
- iOS 从url异步获取图片
- Android 从WebView缓存中获取网页图片
- Android 从WebView缓存中获取网页图片
- Android从网络获取图片,并缓存到SD卡
- Android 从WebView缓存中获取网页图片
- Thinking in Java:对象初始化顺序
- cuda 矩阵乘法
- c#制作一个TCP/UDP测试工具
- 零PHP基础搭建phpMyAdmin连接远程数据库
- hdu1848(斐波那契数列+SG函数)
- Android Smart Image View使用方法--从url获取图片或从通讯录获取图片,支持缓存
- oracle管理表
- 处理机调度,死锁
- W3School 的 HTML 快速参考
- 关于使用strip_tag过滤字符串中的html标签
- 摄像机标定
- 使用DbgHelp获取函数调用堆栈之inline assembly(内联汇编)法
- Java获取各种常用时间方法(工具类)
- MFC遍历文件夹