1、获得当前项目资源文件(assets)下图片

    (1).获得图片数据流

 

   private Bitmap getBotMapInfo() {
Bitmap bitmap = null;
try {
InputStream is = mContext.getAssets().open("picture/ic_northeasttycoon.png");
bitmap = BitmapFactory.decodeStream(is);
is.close();
} catch (IOException e) {
e.printStackTrace();
}
return bitmap;
}
(2) 绑定需要的图片
mIv_north_back.setImageBitmap(getBotMapInfo());  // mIv_north_back 页面图片ID
2、 获得安装到android设备的目录进行绑定
(1)、获得当前设备放图片目录
String path= Environment.getExternalStorageDirectory()+ File.separator+"ic_northeasttycoon.png";
Bitmap bm = BitmapFactory.decodeFile(path);
(2)、绑定图片
mIv_north_back.setImageBitmap(bm);

相关文章:

  • 2022-12-23
  • 2021-09-07
  • 2021-08-07
  • 2022-02-16
  • 2022-12-23
  • 2021-12-09
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-03-05
  • 2021-12-14
  • 2022-12-23
  • 2021-09-20
  • 2022-12-23
相关资源
相似解决方案