SmartImageView的简单使用
来源:互联网 发布:无损音乐网站 知乎 编辑:程序博客网 时间:2024/06/15 19:41
SmartImageView主要是为了加速从网上加载图片,支持根据URL地址加载图片,支持异步加载图片,支持图片缓存等。
下载地址 http://loopj.com/android-smart-image-view/
下载完成后拷贝到项目下的libs文件下即可。
在xml文件下添加一个SmartImageView控件
<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" > <com.loopj.android.image.SmartImageView android:id="@+id/sv_1" android:layout_width="fill_parent" android:layout_height="300dp" /></LinearLayout>
MainActivity.class
package com.example.smartimageview;import com.loopj.android.image.SmartImageView;import android.os.Bundle;import android.app.Activity;import android.view.Menu;public class MainActivity extends Activity { private SmartImageView sv_1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); sv_1 = (SmartImageView) findViewById(R.id.sv_1); sv_1.setImageUrl("http://s1.dwstatic.com/lushicard/Lyra_the_Sunshard.png",//加载指定地址的图片 R.drawable.ic_launcher,//指定图片没找到时显示的图片 R.drawable.ic_launcher);//正在加载中显示的图片 } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; }}
添加访问网络的权限 android.permission.INTERNET
使用Eclipse千万别忘了权限,权限,权限。AndroidMainfest.xml
<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.smartimageview" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="18" /> <uses-permission android:name="android.permission.INTERNET"/> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name="com.example.smartimageview.MainActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application></manifest>
就只是简单的使用下。
阅读全文
2 0
- SmartImageView的简单使用
- SmartImageView的使用
- SmartImageView使用
- AsynHttpClient和SmartImageView控件的使用
- Android SmartImageView使用实例
- SmartImageView框架使用
- SmartImageView框架使用
- 使用SmartImageView控件实现网络图片的浏览
- 新闻客户端(AsyncHttpClient和SmartImageView的综合使用)
- AsyncHttpClient和SmartImageView的综合使用--新闻客户端
- AsyncHttpClient和SmartImageView的使用及案例(新闻客户端)
- 新闻客户端(AsyncHttpClient和SmartImageView的综合使用
- AsyncHttpClient和SmartImageView的综合使用--新闻客户端
- SmartImageView
- SmartImageView
- SmartImageView
- SmartImageView
- SmartImageView
- html页面上传图片并进行展示
- 欢迎使用CSDN-markdown编辑器
- Android中配置JDK和SDK的环境变量
- 版本控制:git合并代码
- NKOJ 高考假期思维赛 Round2(Div.1) B 水果派
- SmartImageView的简单使用
- Linux curl命令详解
- Ubuntu安装N卡驱动的那些坑(多显卡)
- select/poll源码分析——I/O复用函数总结(一)
- Popwindow 无背景无响应疑问解决
- linux (ubuntu)下安装使用QQ的方法--超级棒的
- 一、shader和渲染管线
- 双系统 Ubuntu的启动引导界面消失 grub
- 感恩与我们同行(参赛作文)