标签:
//远程图片
public void httpBtnOnClick(View view) {
//网络图片URL
String path = "http://p4.so.qhimg.com/t0102672bd8a6bd290e.jpg";
imageView.setImageURI(Uri.parse(path));
}
//res目录下的资源
public void resBtnOnClick(View view) {
//RES资源加载
StringBuilder path = new StringBuilder("res://");
//当前包名
path.append(this.getPackageName());
path.append("/");
//资源ID
path.append(String.valueOf(R.mipmap.a_0));//R.mipmap.a_0与R.drawable.a_0同样引用图片的资源ID
imageView.setImageURI(Uri.parse(path.toString()));
}
标签:
原文地址:http://www.cnblogs.com/QQ80565970/p/4769469.html