如果要更改应用的启动图标和启动画面在以前版本中只需要两个步骤:
- 生成应用的图标最小的尺寸是192x192px,不过我建议最好的效果是1024x1024px,启动画面的图片是2208x2208px中间区域是1200x1200px后缀名可以是:.png,.psd.ai
- 然后在你项目的根目录文件下找到resources文件夹(如果没有一般要执行 ionic build以后才会出现),结构如下
- 然后在你根目录的文件下执行:
$ ionic resources
或
$ ionic resources --icon ##单独生成应用图标
$ ionic resources --splash ##单独生成应启动画面图片
ionic会把你的图标上传到它的服务器然后再给你返回来,所以必须能上网,注意: 图标必须是.png,.psd.ai不能是由其它的图标更改后者来的
执行成功后会在你config.xml下生成如下的代码:
<platform name="android">
<icon src="resources/android/icon/drawable-ldpi-icon.png" density="ldpi"/>
<icon src="resources/android/icon/drawable-mdpi-icon.png" density="mdpi"/>
<icon src="resources/android/icon/drawable-hdpi-icon.png" density="hdpi"/>
<icon src="resources/android/icon/drawable-xhdpi-icon.png" density="xhdpi"/>
<icon src="resources/android/icon/drawable-xxhdpi-icon.png" density="xxhdpi"/>
<icon src="resources/android/icon/drawable-xxxhdpi-icon.png" density="xxxhdpi"/>
<splash src="resources/android/splash/drawable-land-ldpi-screen.png" density="land-ldpi"/>
<splash src="resources/android/splash/drawable-land-mdpi-screen.png" density="land-mdpi"/>
<splash src="resources/android/splash/drawable-land-hdpi-screen.png" density="land-hdpi"/>
<splash src="resources/android/splash/drawable-land-xhdpi-screen.png" density="land-xhdpi"/>
<splash src="resources/android/splash/drawable-land-xxhdpi-screen.png" density="land-xxhdpi"/>
<splash src="resources/android/splash/drawable-land-xxxhdpi-screen.png" density="land-xxxhdpi"/>
<splash src="resources/android/splash/drawable-port-ldpi-screen.png" density="port-ldpi"/>
<splash src="resources/android/splash/drawable-port-mdpi-screen.png" density="port-mdpi"/>
<splash src="resources/android/splash/drawable-port-hdpi-screen.png" density="port-hdpi"/>
<splash src="resources/android/splash/drawable-port-xhdpi-screen.png" density="port-xhdpi"/>
<splash src="resources/android/splash/drawable-port-xxhdpi-screen.png" density="port-xxhdpi"/>
<splash src="resources/android/splash/drawable-port-xxxhdpi-screen.png" density="port-xxxhdpi"/>
</platform>
<icon src="resources/android/icon/drawable-xhdpi-icon.png"/>
但是你可能发现你的启动画面没有,可能就是黑了一下就到了应用了,无论你怎么去更改你的config.xml都是没有效果的,经过几番折腾发现了解决办法:
cordova-plugin-splashscreen
必须安装这个插件才能显示启动画面,进入你的应用目录搞起….
$ cordova plugin add cordova-plugin-splashscreen