cordova学习二:图标与启动屏幕设置

一、图标设置
<icon src="res/ios/icon.png" platform="ios" width="57" height="57" density="mdpi" />
在config.xml里配置icon标签设置app图标
src:图片存放路径
platform:支持平台
width:图标宽度
height:图标高度
density:android下针对不同分辨率适配的图标

应用于所有平台:
<icon src="res/icon.png" />

Amazon Fire OS:

 <platform name="amazon-fireos">
              <icon src="res/android/ldpi.png" density="ldpi" />
              <icon src="res/android/mdpi.png" density="mdpi" />
              <icon src="res/android/hdpi.png" density="hdpi" />
              <icon src="res/android/xhdpi.png" density="xhdpi" />
     </platform>

Android:

  <platform name="android">
              <icon src="res/android/ldpi.png" density="ldpi" />
              <icon src="res/android/mdpi.png" density="mdpi" />
              <icon src="res/android/hdpi.png" density="hdpi" />
              <icon src="res/android/xhdpi.png" density="xhdpi" />
     </platform>
BlackBerry10:

<platform name="blackberry10">
    <icon src="res/bb10/icon-86.png" />
    <icon src="res/bb10/icon-150.png" />
</platform>

See BlackBerry's documentation for targeting multiple sizes and locales. [ http://developer.blackberry.com/html5/documentation/icon_element.html]

Firefox OS:
     <platform name="firefoxos">
              <icon src="res/ff/logo.png" width="60" height="60" />
     </platform>
iOS:

     <platform name="ios">
              <!-- iOS 8.0+ -->
              <!-- iPhone 6 Plus  -->
              <icon src="res/ios/icon-60@3x.png" width="180" height="180" />
              <!-- iOS 7.0+ -->
              <!-- iPhone / iPod Touch  -->
              <icon src="res/ios/icon-60.png" width="60" height="60" />
              <icon src="res/ios/icon-60@2x.png" width="120" height="120" />
              <!-- iPad -->
              <icon src="res/ios/icon-76.png" width="76" height="76" />
              <icon src="res/ios/icon-76@2x.png" width="152" height="152" />
              <!-- iOS 6.1 -->
              <!-- Spotlight Icon -->
              <icon src="res/ios/icon-40.png" width="40" height="40" />
              <icon src="res/ios/icon-40@2x.png" width="80" height="80" />
              <!-- iPhone / iPod Touch -->
              <icon src="res/ios/icon.png" width="57" height="57" />
              <icon src="res/ios/icon@2x.png" width="114" height="114" />
              <!-- iPad -->
              <icon src="res/ios/icon-72.png" width="72" height="72" />
              <icon src="res/ios/icon-72@2x.png" width="144" height="144" />
              <!-- iPhone Spotlight and Settings Icon -->
              <icon src="res/ios/icon-small.png" width="29" height="29" />
              <icon src="res/ios/icon-small@2x.png" width="58" height="58" />
              <!-- iPad Spotlight and Settings Icon -->
              <icon src="res/ios/icon-50.png" width="50" height="50" />
              <icon src="res/ios/icon-50@2x.png" width="100" height="100" />
     </platform>
Tizen:

     <platform name="tizen">
              <icon src="res/tizen/icon-128.png" width="128" height="128" />
     </platform>

Windows Phone8:

     <platform name="wp8">
              <icon src="res/wp/ApplicationIcon.png" width="99" height="99" />
              <!-- tile image -->
              <icon src="res/wp/Background.png" width="159" height="159" />
     </platform>
Windows8:

     <platform name="windows8">
              <icon src="res/windows8/logo.png" width="150" height="150" />
              <icon src="res/windows8/smalllogo.png" width="30" height="30" />
              <icon src="res/windows8/storelogo.png" width="50" height="50" />
     </platform>

二、启动屏幕设置
图片文件放在www之外目录,支持平台:android、ios、wp8、windows8、blackberry10
设置图片路径后必须结合时间设置<preference name="SplashScreenDelay" value="5000" />
<platform name="android">
    <!-- you can use any density that exists in the Android project -->
    <splash src="res/screen/android/splash-land-hdpi.png" density="land-hdpi"/>
    <splash src="res/screen/android/splash-land-ldpi.png" density="land-ldpi"/>
    <splash src="res/screen/android/splash-land-mdpi.png" density="land-mdpi"/>
    <splash src="res/screen/android/splash-land-xhdpi.png" density="land-xhdpi"/>

    <splash src="res/screen/android/splash-port-hdpi.png" density="port-hdpi"/>
    <splash src="res/screen/android/splash-port-ldpi.png" density="port-ldpi"/>
    <splash src="res/screen/android/splash-port-mdpi.png" density="port-mdpi"/>
    <splash src="res/screen/android/splash-port-xhdpi.png" density="port-xhdpi"/>
</platform>

<platform name="ios">
    <!-- images are determined by width and height. The following are supported -->
    <splash src="res/screen/ios/Default~iphone.png" width="320" height="480"/>
    <splash src="res/screen/ios/Default@2x~iphone.png" width="640" height="960"/>
    <splash src="res/screen/ios/Default-Portrait~ipad.png" width="768" height="1024"/>
    <splash src="res/screen/ios/Default-Portrait@2x~ipad.png" width="1536" height="2048"/>
    <splash src="res/screen/ios/Default-Landscape~ipad.png" width="1024" height="768"/>
    <splash src="res/screen/ios/Default-Landscape@2x~ipad.png" width="2048" height="1536"/>
    <splash src="res/screen/ios/Default-568h@2x~iphone.png" width="640" height="1136"/>
    <splash src="res/screen/ios/Default-667h.png" width="750" height="1334"/>
    <splash src="res/screen/ios/Default-736h.png" width="1242" height="2208"/>
    <splash src="res/screen/ios/Default-Landscape-736h.png" width="2208" height="1242"/>
</platform>

<platform name="wp8">
    <!-- images are determined by width and height. The following are supported -->
    <splash src="res/screen/wp8/SplashScreenImage.jpg" width="768" height="1280"/>
</platform>

<platform name="windows8">
    <!-- images are determined by width and height. The following are supported -->
    <splash src="res/screen/windows8/splashscreen.png" width="620" height="300"/>
</platform>

<platform name="blackberry10">
    <!-- Add a rim:splash element for each resolution and locale you wish -->
    <!-- http://developer.blackberry.com/html5/documentation/rim_splash_element.html -->
    <rim:splash src="res/screen/windows8/splashscreen.png"/>
</platform>


<preference name="SplashScreenDelay" value="10000" />
cordova提供的屏幕插件:https://github.com/apache/cordova-plugin-splashscreen
cordova plugin add cordova-plugin-splashscreen
  • 2
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
Cordova是一个开源的移动应用开发框架,它允许开发者使用HTML、CSS和JavaScript来构建跨平台的移动应用程序。Cordova提供了一组API,可以访问设备的原生功能,如摄像头、文件系统、联系人等。通过使用Cordova,开发者可以使用熟悉的Web技术来创建移动应用,而无需学习平台特定的编程语言或工具。 要学习Cordova,你可以按照以下步骤进行: 1. 了解基本的Web开发技术:在学习Cordova之前,建议你先掌握HTML、CSS和JavaScript等基本的Web开发技术,因为Cordova使用这些技术来构建应用程序界面和逻辑。 2. 安装Cordova:你需要在本地环境中安装Cordova。可以通过npm(Node Package Manager)来安装Cordova命令行工具。具体的安装步骤可以参考Cordova官方文档。 3. 创建Cordova项目:使用Cordova命令行工具创建一个新的Cordova项目。在项目中,你可以定义应用程序的名称、包名、支持的平台等信息。 4. 编写应用程序代码:在Cordova项目中,你可以使用HTML、CSS和JavaScript来编写应用程序的界面和逻辑。你可以使用各种前端框架(如AngularJS、React等)来加快开发速度。 5. 添加插件:Cordova提供了一系列的插件,用于访问设备的原生功能。你可以使用Cordova命令行工具来添加这些插件到你的项目中,并在应用程序中使用它们。 6. 构建和运行应用程序:使用Cordova命令行工具,你可以构建应用程序的进制文件,并将其部署到模拟器、真机或浏览器中进行测试。 7. 学习和解决问题:在学习过程中,你可能会遇到一些问题或困惑。可以参考Cordova官方文档、社区论坛或其他在线资源来获取帮助和解决问题。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值