如何将壁纸放入 apk 文件中?

发布于 2024-09-19 21:41:17 字数 242 浏览 5 评论 0原文

我计划发布一个漂亮的时钟小部件,并且我想在其中包含一个漂亮的壁纸(想要这样做,因为之前收到了一些评论,例如“我可以获得匹配的壁纸吗?;)”)

所以我尝试谷歌关于如何将一些图像文件放入 apk 中,以便安装后它会出现在壁纸选择列表中。我的意思是在执行“主页=>菜单=>壁纸=>壁纸库”或“图片”时出现的列表 - 无论如何。

目前还没有找到任何提示,所以决定尝试在这里询问。

关于如何做到这一点有任何提示吗?

I'm planning to release a nice clock widget and I'd like to include a pretty wallpaper with it (want to do this because previously got some comments like "can i get the matching wallpaper? ;)")

So I tried to google on how to put some image file inside apk so that it would appear in wallpapers selection list after installation. I mean the list which appears when doing Home=>Menu=>Wallpaper=>Wallpaper Gallery or Pictures - whatever.

So far didn't find any hints, so decided to try to ask here.

Any hints on how to do that?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

甜`诱少女 2024-09-26 21:41:17

您可以将壁纸打包在 res/raw 中,然后当您的应用程序第一次启动时,尝试将其复制到 sdcard 目录 /media/pictures。

您应该使用 getExternalStorageDirectory 或 getExternalStoragePublicDirectory 等方法(取决于 API 级别)来打开文件。

http://developer.android.com/guide/topics/数据/data-storage.html#filesExternal

You could package the wallpaper in res/raw, and then when your app fires up for the first time, attempt to copy it to the sdcard directory /media/pictures.

You should be using methods such as getExternalStorageDirectory or getExternalStoragePublicDirectory (depending on the API level) to open the file.

http://developer.android.com/guide/topics/data/data-storage.html#filesExternal

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