ionic生成全尺寸icon和splash
http://www.jianshu.com/p/eda363eb28d3
重新添加platform
--no-resources可以禁止重新生成icon和splash
ionic cordova platform remove android
ionic cordova platform add android --no-resources
1. icon
提供1024*1024的icon.png图片, 放到根目录下的resources目录下, 执行命令就能生成各个尺寸的图片了
ionic cordova resources --icon
2. splash
先安装插件
$ ionic cordova plugin add cordova-plugin-splashscreen
同样的提供2732*2732的splash.png图片, 执行命名
ionic cordova resources --splash
注意
一定要是真的png图片, 改后缀是无效的, 同时添加了对应的platform才会生成.
修改过splash图片可能会出现打包错误的问题 - Execution failed for task ':mergeDebugResources'.
办法是在platforms\android\build.gradle中加入下面这段
android {
aaptOptions.cruncherEnabled = false
aaptOptions.useNewCruncher = false
默认3秒后隐藏会显示一个黑屏. 设置加载好之后才隐藏splash
config.xml中加入下面的配置, SplashShowOnlyFirstTime可以单独给android添加. 参考: ionic开发之splash screen配置问题
<preference name="SplashScreenDelay" value="3000" />
<preference name="ShowSplashScreenSpinner" value="false" />
<preference name="AutoHideSplashScreen" value="false" />
<preference name="FadeSplashScreen" value="false" />
<preference name="SplashMaintainAspectRatio" value="false" />
<preference name="SplashShowOnlyFirstTime" value="true" />
help
λ ionic cordova resources --help
? The Ionic CLI has an update available (3.18.0 => 3.19.0)! Would you like to install it? No
Not automatically updating your CLI.
ionic cordova resources - Automatically create icon and splash screen resources
Ionic can automatically generate perfectly sized icons and splash screens from source images (.png, .psd, or .ai)
for your Cordova platforms.
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, there should already be default Ionic resources in the resources/ directory, which you can overwrite.
You can also generate platform-specific icons and splash screens by placing them in the respective
resources/<platform>/ directory. For example, to generate an icon for Android, place your image at
resources/android/icon.png.
By default, this command will not regenerate resources whose source image has not changed. To disable this
functionality and always overwrite generated images, use --force.
For best results, the splash screen's artwork should roughly fit within a square (1200×1200px) at the center of the
image. You can use https://code.ionicframework.com/resources/splash.psd as a template for your splash screen.
ionic cordova resources will automatically update your config.xml to reflect the changes in the generated images,
which Cordova then configures.
Cordova reference documentation:
- Icons: https://cordova.apache.org/docs/en/latest/config_ref/images.html
- Splash Screens: https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-splashscreen/
This command uses Ionic servers, so we require you to be logged into your free Ionic account. Use ionic login to
login.
Usage:
$ ionic cordova resources [<platform>] [options]
Inputs:
platform ................. The platform for which you would like to generate resources (android, ios)
Options:
--force, -f .............. Force regeneration of resources
--icon, -i ............... Generate icon resources
--splash, -s ............. Generate splash screen resources
Examples:
$ ionic cordova resources
$ ionic cordova resources ios
$ ionic cordova resources android
欢迎页图片规格, 都是.png的图片
android
480*800
240*320
320*480
720*1280
960*1600
1280*1920
IOS
640*960
320*480
640*1136
750*1334
1242*2280
备份一个配置文件
准备只配置prot的图片, 缩小app
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.zehuiwenhua.xiaoshutong" version="1.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>小书童</name>
<description>An awesome Ionic/Cordova app.</description>
<author email="hi@ionicframework" href="http://ionicframework.com/">Ionic Framework Team</author>
<content src="index.html" />
<access origin="*" />
<allow-navigation href="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<preference name="AllowInlineMediaPlayback" value="true" />
<preference name="webviewbounce" value="false" />
<preference name="UIWebViewBounce" value="false" />
<preference name="DisallowOverscroll" value="true" />
<preference name="android-minSdkVersion" value="16" />
<preference name="BackupWebStorage" value="none" />
<preference name="SplashMaintainAspectRatio" value="true" />
<preference name="FadeSplashScreenDuration" value="300" />
<preference name="SplashShowOnlyFirstTime" value="false" />
<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="10000" />
<preference name="ShowSplashScreenSpinner" value="false" />
<preference name="AutoHideSplashScreen" value="false" />
<preference name="FadeSplashScreen" value="true" />
<preference name="SplashMaintainAspectRatio" value="false" />
<preference name="orientation" value="portrait" />
<platform name="android">
<name>小书童</name>
<allow-intent href="market:*" />
<icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" />
<icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png" />
<icon density="hdpi" src="resources/android/icon/drawable-hdpi-icon.png" />
<icon density="xhdpi" src="resources/android/icon/drawable-xhdpi-icon.png" />
<icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png" />
<icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png" />
<splash density="land-ldpi" src="resources/android/splash/drawable-land-ldpi-screen.png" />
<splash density="land-mdpi" src="resources/android/splash/drawable-land-mdpi-screen.png" />
<splash density="land-hdpi" src="resources/android/splash/drawable-land-hdpi-screen.png" />
<splash density="land-xhdpi" src="resources/android/splash/drawable-land-xhdpi-screen.png" />
<splash density="land-xxhdpi" src="resources/android/splash/drawable-land-xxhdpi-screen.png" />
<splash density="land-xxxhdpi" src="resources/android/splash/drawable-land-xxxhdpi-screen.png" />
<splash density="port-ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png" />
<splash density="port-mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png" />
<splash density="port-hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png" />
<splash density="port-xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png" />
<splash density="port-xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png" />
<splash density="port-xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png" />
</platform>
<platform name="ios">
<name>小书童</name>
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
<icon height="57" src="resources/ios/icon/icon.png" width="57" />
<icon height="114" src="resources/ios/icon/icon@2x.png" width="114" />
<icon height="40" src="resources/ios/icon/icon-40.png" width="40" />
<icon height="80" src="resources/ios/icon/icon-40@2x.png" width="80" />
<icon height="120" src="resources/ios/icon/icon-40@3x.png" width="120" />
<icon height="50" src="resources/ios/icon/icon-50.png" width="50" />
<icon height="100" src="resources/ios/icon/icon-50@2x.png" width="100" />
<icon height="60" src="resources/ios/icon/icon-60.png" width="60" />
<icon height="120" src="resources/ios/icon/icon-60@2x.png" width="120" />
<icon height="180" src="resources/ios/icon/icon-60@3x.png" width="180" />
<icon height="72" src="resources/ios/icon/icon-72.png" width="72" />
<icon height="144" src="resources/ios/icon/icon-72@2x.png" width="144" />
<icon height="76" src="resources/ios/icon/icon-76.png" width="76" />
<icon height="152" src="resources/ios/icon/icon-76@2x.png" width="152" />
<icon height="167" src="resources/ios/icon/icon-83.5@2x.png" width="167" />
<icon height="29" src="resources/ios/icon/icon-small.png" width="29" />
<icon height="58" src="resources/ios/icon/icon-small@2x.png" width="58" />
<icon height="87" src="resources/ios/icon/icon-small@3x.png" width="87" />
<icon height="1024" src="resources/ios/icon/icon-1024.png" width="1024" />
<splash height="1136" src="resources/ios/splash/Default-568h@2x~iphone.png" width="640" />
<splash height="1334" src="resources/ios/splash/Default-667h.png" width="750" />
<splash height="2208" src="resources/ios/splash/Default-736h.png" width="1242" />
<splash height="1242" src="resources/ios/splash/Default-Landscape-736h.png" width="2208" />
<splash height="1536" src="resources/ios/splash/Default-Landscape@2x~ipad.png" width="2048" />
<splash height="2048" src="resources/ios/splash/Default-Landscape@~ipadpro.png" width="2732" />
<splash height="768" src="resources/ios/splash/Default-Landscape~ipad.png" width="1024" />
<splash height="2048" src="resources/ios/splash/Default-Portrait@2x~ipad.png" width="1536" />
<splash height="2732" src="resources/ios/splash/Default-Portrait@~ipadpro.png" width="2048" />
<splash height="1024" src="resources/ios/splash/Default-Portrait~ipad.png" width="768" />
<splash height="960" src="resources/ios/splash/Default@2x~iphone.png" width="640" />
<splash height="480" src="resources/ios/splash/Default~iphone.png" width="320" />
<splash height="2732" src="resources/ios/splash/Default@2x~universal~anyany.png" width="2732" />
</platform>
<engine name="browser" spec="^5.0.1" />
<engine name="ios" spec="4.5.4" />
<engine name="android" spec="6.3.0" />
<plugin name="ionic-plugin-keyboard" spec="^2.2.1" />
<plugin name="cordova-plugin-whitelist" spec="^1.3.1" />
<plugin name="cordova-plugin-statusbar" spec="^2.2.1" />
<plugin name="cordova-plugin-device" spec="^1.1.4" />
<plugin name="cordova-plugin-splashscreen" spec="^4.0.3" />
<plugin name="cordova-plugin-camera" spec="^3.0.0" />
<plugin name="cordova-plugin-file" spec="^5.0.0" />
<plugin name="cordova-plugin-console" spec="^1.1.0" />
<plugin name="cordova-plugin-file-transfer" spec="^1.7.0" />
<plugin name="cordova-plugin-wechat" spec="^2.1.0">
<variable name="WECHATAPPID" value="wx4a525790c75c494f" />
</plugin>
<plugin name="cordova-plugin-screen-orientation" spec="^2.0.2" />
<plugin name="jpush-phonegap-plugin" spec="^3.2.12">
<variable name="APP_KEY" value="26218938532daa6c8446c2b5" />
</plugin>
<plugin name="es6-promise-plugin" spec="^4.1.1" />
<plugin name="cordova-plugin-network-information" spec="~1.3.4" />
<plugin name="cordova-plugin-screensize" spec="^1.3.1" />
<plugin name="cordova-plugin-app-version" spec="^0.1.9" />
<plugin name="cordova-plugin-file-opener2" spec="^2.0.19" />
</widget>
ionic生成全尺寸icon和splash的更多相关文章
- CSS之生成全屏背景图片
在CSS中背景图片的填充方法: background-position:x,y(背景图片x,y轴的定位) background-repeat:no-repeat(不平铺) background-rep ...
- ionic生成apk使用build命令下载gradle-2.2.1-all.zip卡,解决方案
ionic生成apk使用build命令下载gradle-2.2.1-all.zip卡,解决方案 直接使用ionic build android命令,自动下载gradle-2.2.1-all.zip超慢 ...
- C# 中使用 ThoughtWorks.QRCode.dll 生成指定尺寸和边框宽度的二维码
本文介绍在 C# 中使用 ThoughtWorks.QRCode.dll 生成指定尺寸和边框宽度的二维码.网上文章大多只是简单介绍内置参数的设置,根据我的使用目的,增加了自定义目标二维码图片尺寸和白边 ...
- 【转】C# 中使用 ThoughtWorks.QRCode.dll 生成指定尺寸和边框宽度的二维码
本文介绍在 C# 中使用 ThoughtWorks.QRCode.dll 生成指定尺寸和边框宽度的二维码.网上文章大多只是简单介绍内置参数的设置,根据我的使用目的,增加了自定义目标二维码图片尺寸和白边 ...
- ionic生成签名的APK方法总结
ionic生成签名的apk步骤如下: 1. 在项目目录下运行 ionic build android --release 先生成一个未签名的apk 2. 在项目目录下运行 keytool -genke ...
- 在RPA中使用Python批量生成指定尺寸的缩略图!比Ps好用!
前言 文的文字及图片来源于网络,仅供学习.交流使用,不具有任何商业用途,版权归原作者所有,如有问题请及时联系我们以作处理. PS:如有需要Python学习资料的小伙伴可以加点击下方链接自行获取 htt ...
- Thinkphp自定义生成缩略图尺寸的方法
Thinkphp自定义生成缩略图尺寸的方法,本实例中生成两张不同尺寸的图片:第一张是大图350*350,第二张 50*50的缩略图 Image类是Thinkphp系统自带的,可以研究下,这个缩略图类很 ...
- phpqrcode生成任意尺寸的二维码
在Thinkphp中整合phpqrcode用于生成二维码,其代码如下: vendor("phpqrcode.phpqrcode"); QRcode::png('http://www ...
- 基于.NetCore开发博客项目 StarBlog - (15) 生成随机尺寸图片
系列文章 基于.NetCore开发博客项目 StarBlog - (1) 为什么需要自己写一个博客? 基于.NetCore开发博客项目 StarBlog - (2) 环境准备和创建项目 基于.NetC ...
随机推荐
- Service Fabric SfDevCluster目录从默认的C盘移动
管理员权限打开Powershell CD\ 回车 CD "C:\Program Files\Microsoft SDKs\Service Fabric\ClusterSetup" ...
- python面试题之Python是如何进行内存管理的
python内部使用引用计数,来保持追踪内存中的对象,Python内部记录了对象有多少个引用,即引用计数,当对象被创建时就创建了一个引用计数,当对象不再需要时,这个对象的引用计数为0时,它被垃圾回收. ...
- 026 UI调试
读了这篇文档,感觉蛮好玩的.粘贴一下链接: http://www.cnblogs.com/Wayou/p/chrome-console-tips-and-tricks.html
- 关于ACtion类利用file类型取得上传文件的内容,名字和内容类型
上面的Action提供了两个属性:uploadFileName和uploadContentType,这个两个属性分别用于封转上传文件的文件名.上传文件的文件类型.Action类直接通过File类型属性 ...
- Java大数相加(多个大数相加)-hdu1250
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1250 题目描述: 题目大意是:已知一个Hat's Fibonacci序列,该序列满足F(1) = 1, ...
- 关于pycharm中安装第三方库时报错的解决办法(一)
记录自己的生活! 一.事发背景 在pycharm中直接安装第三方库时因为版本问题总是无法安装成功,事情不大,但是很重要. 二.经过 最开始我自己电脑上安装了Python3.6和Python2. ...
- POJ2387 Til the Cows Come Home【Kruscal】
题目链接>>> 题目大意: 谷仓之间有一些路径长度,然后要在这些谷仓之间建立一些互联网,花费的成本与长度成正比,,并且要使这些边连起来看的像一课“树”,然后使成本最大 解题思路: 最 ...
- burpsuite https证书设置
java更新.burpsuite换来换去,chrome的证书似乎失效了.重新来一边证书导入,有一些导入方法确实坑. 尝试了直接导入到受信任的机构是无效的. 两年前就因为导入到受信任的机构,又找不到导入 ...
- Spring Boot 项目实战(六)集成 Apollo
一.前言 上篇介绍了 Spring Boot 集成 Dubbo,使我们的系统打下了分布式的基础.随着程序功能的日益复杂,程序的配置日益增多:各种功能开关.参数配置.服务器地址等:对程序配置的期望值也越 ...
- 安装win7出现安装程序无法创建新的系统分区
安装win7的时候出现“安装程序无法创建新的系统分区 也无法定位系统分区”! 我是直接把一个系统碟里面的安装文件全部拷出来.放到要安装系统的机器(D盘).用的是老毛桃的winpe已经安装好了.我的安装 ...