将位图添加到可绘制资源

发布于 2024-10-10 01:49:42 字数 107 浏览 0 评论 0原文

如何将从网络(我的意思是在应用程序中!)获取的位图添加到可绘制资源中?所以我可以使用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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

诺曦 2024-10-17 01:49:42

安装应用程序后,您将无法修改该文件夹。在这种情况下,您必须将位图复制到文件并从那里访问它。看看另一个问题:

将位图保存到位置

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

零度℉ 2024-10-17 01:49:42

这些资源是在 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文