javascript 如何更改 Ionic 4 应用程序中的默认应用程序图标和启动画面?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/55813237/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to change default App Icon and Splash Screen in Ionic 4 application?
提问by Abhijit M. Abhi
I'm developing Ionic 4 app with angular. But, I have stuck in how to change the default App Icon and Splash Screen. I've already go through the Ionic 4 documentation (https://ionicframework.com/docs/native/splash-screen#usage) but din't find any suitable solution yet. In StakOverflow I've found Lottie Splash Screenwhich is one kind of solution but not similar how Ionic default Splash screen works. So, do you have any suggestion how to overcome this issue.
我正在开发带有角度的 Ionic 4 应用程序。但是,我一直坚持如何更改默认的应用程序图标和启动画面。我已经阅读了 Ionic 4 文档(https://ionicframework.com/docs/native/splash-screen#usage),但还没有找到任何合适的解决方案。在 StakOverflow 中,我发现Lottie Splash Screen是一种解决方案,但与 Ionic 默认启动画面的工作方式不同。那么,您对如何克服这个问题有什么建议吗?
回答by Sam
I use ionic 3 and I think ionic 4 its the same , in your project folder , you have a resources directory, go in.
To change the default icon , just change the icon.pngby your image, if I remember you need to resize your image (1024*1024).
To change the default splashscreen, its the same (2732*2732).
Don't forget to rename your image (icon.png and splash.png)
我使用 ionic 3 和我认为 ionic 4 相同,在您的项目文件夹中,您有一个资源目录,请进入。
要更改默认图标,只需更改icon.png您的图像,如果我记得您需要调整图像大小( 1024*1024)。
要更改默认启动画面,其相同(2732 * 2732)。
不要忘记重命名您的图像(icon.png 和 splash.png)
And after change, just update your project :
更改后,只需更新您的项目:
ionic cordova resources
ionic cordova resources
回答by benra
The source image for icons should ideally be at least 1024×1024px and located at resources/icon.png. The source image for splash screens should ideally be at least 2732×2732px and located at resources/splash.png. If you used ionic start(run in your terminal within your app folder), there should already be default Ionic resources in the resources/ directory, which you can overwrite.
ionic cordova resources(run in your terminal within your app folder) will automatically update your config.xml to reflect the changes in the generated images, which Cordova then configures.
理想情况下,图标的源图像应至少为 1024×1024 像素,并位于 resources/icon.png。初始屏幕的源图像理想情况下应至少为 2732×2732 像素,并位于 resources/splash.png。如果您使用ionic start(在您的应用程序文件夹中的终端中运行),则资源/目录中应该已经有默认的 Ionic 资源,您可以覆盖这些资源。
ionic cordova resources(在您的应用程序文件夹中的终端中运行)将自动更新您的 config.xml 以反映生成的图像中的更改,然后 Cordova 对其进行配置。

