Android从asset中获取drawable
16lz
2021-12-04
Android从asset中获取drawable
public static Drawable assets2Drawable(Context context, String fileName) { InputStream open = null; Drawable drawable = null; try { open = context.getAssets().open(fileName); drawable = Drawable.createFromStream(open, null); } catch (IOException e) { e.printStackTrace(); } finally { try { if (open != null) { open.close(); } } catch (IOException e) { e.printStackTrace(); } } return drawable;}
更多相关文章
- android获取手机信息大全
- Android(安卓)获取天气预报
- Android(安卓)Studio 基础控件使用
- 获取 + 查看 Android(安卓)源码的 方法
- Android坐标系、视图坐标系与触控事件(MotionEvent)
- 腾讯面试官:Binder的系统服务是如何获取的?
- 二十四、Android文件的读写
- Android异步处理一:使用Thread+Handler实现非UI线程更新UI界面
- android拍照获取图片