将位图添加到可绘制资源
如何将从网络(我的意思是在应用程序中!)获取的位图添加到可绘制资源中?所以我可以使用R.drawable.bitmapName
访问Bitmap
...
How can I add a Bitmap
taken from the web (in the app i mean!) to the drawable resources? So i can access the Bitmap
using R.drawable.bitmapName
...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
安装应用程序后,您将无法修改该文件夹。在这种情况下,您必须将位图复制到文件并从那里访问它。看看另一个问题:
将位图保存到位置
You can't modify that folder once your app is installed. In that case, you must copy the bitmap to a file and access it from there. Take a look at this other question:
Save bitmap to location
这些资源是在 apk 构建时编译的,因此您无法在运行时更改它。如果您想要一些标识符,您可以考虑创建一个共享首选项,您可以将下载的图像文件与某个 ID 相关联。但实现该功能需要您付出一些努力。
The resources are compiled at the apk building time, so you cannot change it in runtime. If you want to have some identifier you can consider creating a shared preference where you can put in relation the downloaded image file with some id. But it will take some effort from you to implement the functionality.