如何获取assets文件夹下的图片,加载到ImageView中显示

如题所述

第1个回答  2013-10-18
AssetManager assets = getAssets();
InputStream is = null;

try {
is = assets.open("images/" + filename);
} catch (IOException e) {
e.printStackTrace();
}
BitmapFactory.Options options = new BitmapFactory.Options();
Bitmap bitmap = BitmapFactory.decodeStream(is, null, options);

ImageView image = (ImageView) findViewById(R.id.tushow);
image.setImageBitmap(bitmap);
第2个回答  2013-08-31
刚学会,用AssetManager 类,AssetManager assets = getAssets();然后assets .open()就可以啦~~~
第3个回答  2013-08-31
学习下sss
第4个回答  推荐于2017-12-16
好像打不开图片吧,上面的方法,我在试试本回答被网友采纳