Android SmartImageView插件实现图片浏览功能

源码下载↓↓↓

在https://github.com网上找的小插件,实现图片浏览的简单功能,很方便。


额,简单的代码都没有几个了、、

package com.example.imageview;

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 {

	EditText editText;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		editText = (EditText) findViewById(R.id.editText1);
	}
	
	public void click(View view){
		SmartImageView image = (SmartImageView) findViewById(R.id.textView1);
		image.setImageUrl(editText.getText().toString().trim(), R.drawable.ic_launcher, R.drawable.ic_launcher);
	}
}
activity_main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <com.loopj.android.image.SmartImageView
        android:id="@+id/textView1"
        android:layout_weight="1"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
      />

    <EditText
        android:id="@+id/editText1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:lines="1"
        android:text="http://img0.bdstatic.com/img/image/shouye/mvznns.jpg"
        android:ems="10" >

        <requestFocus />
    </EditText>

    <Button
        android:id="@+id/button1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:onClick="click"
        android:text="查看" />
    
    </LinearLayout>

点击下载源码
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值