<span style="font-size:24px;">package com.melody.smartimageview;
import com.loopj.android.image.SmartImageView;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void click(View v){
SmartImageView siv = (SmartImageView) findViewById(R.id.iv);
//请求网络图片
siv.setImageUrl("http://192.168.119.69/dd.jpg");
}
}
</span>
////////////////////////////////////////布局文件////////////////////////////
<span style="font-size:24px;"> <Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="查看网络图片"
android:onClick="click"/>
<com.loopj.android.image.SmartImageView
android:id="@+id/iv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"/></span>
/////////////////////////////////记得添加限/////////////////////////////////////////////
<span style="font-size:24px;"> <uses-permission android:name="android.permission.INTERNET"/></span>