【问题标题】:PhoneGap Build - Set splash-screen for Android devicesPhoneGap Build - 为 Android 设备设置启动画面
【发布时间】:2013-01-23 23:26:50
【问题描述】:

我目前正在尝试在 phonegap 构建中为 Android 设备设置启动画面。我设置了 4 个不同的屏幕,但不知何故,屏幕变形并失去了纵横比。有没有办法防止这种情况发生?

最好的问候

【问题讨论】:

  • 您是否将原始启动画面替换为相同大小的图像?
  • @Luce 如果有帮助请接受答案
  • 对不起,我不在线。我会检查你的答案并接受它:)
  • 你说的屏幕变形是什么意思?如果您在 Android 设备上谈论横向非常难看的拉伸启动画面,那么这是一个已确认的错误 (here)。 PhoneGap Build(可能还有 PhoneGap 本身)目前根本不支持横向闪屏。我什至厌倦了 iOS 的方式,如下所示的Red2678,但它仍然无法正常工作。在纵向模式下一切都很好,但不管你将使用什么屏幕密度的 Android 设备——在横向模式下,你会看到丑陋的变形纵向版本的初始屏幕。
  • 您好,您使用的是 .9.png 格式吗?它在纵向模式下变形,但我只使用了 .png。

标签: android cordova splash-screen phonegap-build


【解决方案1】:

Do'h,错过了关于 Android 的问题,这是我的 config.xml 中的 Android 部分:

<gap:splash src="img/splash/android/ldpi.png" gap:platform="android" gap:density="ldpi" />
<gap:splash src="img/splash/android/mdpi.png" gap:platform="android" gap:density="mdpi" />
<gap:splash src="img/splash/android/hdpi.png" gap:platform="android" gap:density="hdpi" />
<!--<gap:splash src="splash/android/xhdpi.png" gap:platform="android" gap:density="xhdpi" />-->

是的,Apple 更容易!在 Android 上,它们使用称为“密度”的限定符。

据我所知,PhoneGap Build 目前仅支持四个中的三个。 ldpi、mdpi、hdpi 和 NOT xdpi(这就是上面注释掉的原因)。

据我了解,所有 Android 设备都将使用这四种尺寸中的一种。在数百种不同的设备上获得完美的纵横比可能有点挑战,但这样你至少可以接近。

读这个,我知道它很多,但值得一读: http://developer.android.com/guide/practices/screens_support.html#support

还有,PGB 指南:http://build.phonegap.com/docs/config-xml

【讨论】:

    【解决方案2】:

    我们可以通过三种方式进行设置

    1. 通过 config.xml
    2. 通过activity类设置属性
    3. 通过脚本

    参考更多示例源代码示例源代码以及 phonegap-build-set-splash-screen 示例

    http://getmebyclickme.blogspot.in/2013/10/phonegap-build-set-splash-screen-for.html

    【讨论】:

      【解决方案3】:

      查看电话间隙@Splash Screen in Phonegap的启动画面详细信息

      【讨论】:

      • 感谢我已经检查了它们,并将这些尺寸添加到 config.xml。问题是除了这些尺寸还有很多。我正在使用 phonegap 构建,而不仅仅是 phonegap。也许那里不可能?
      【解决方案4】:
      import android.os.Bundle;
         import org.apache.cordova.*;
      
        public class RemindMeActivity extends DroidGap {
      /** Called when the activity is first created. */
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          super.setIntegerProperty("splashscreen", R.drawable.splash);
          super.loadUrl("file:///android_asset/www/index.html", 10000);
      
      
      }
      }
      

      这将帮助您使用 phonegap 显示启动画面

      【讨论】:

      • 嗨,谢谢。由于我正在使用 phonegap 构建,因此无法更改 java 项目中的某些内容,因为我只是在部署 www 文件和一个配置文件,我可以在其中添加屏幕。甚至可以使用phonegap构建吗?
      【解决方案5】:

      这就是我的 PGB config.xml(您的文件夹结构和文件名会有所不同)的方式,这支持我相信的大多数 IOS 设备。您有多少张启动图片?

      <gap:splash src="img/splash/ios/Default.png" width="320" height="480" />
      <gap:splash src="img/splash/ios/Default_at_2x.png" width="640" height="960" />
      <gap:splash src="img/splash/ios/Default_iphone5.png" width="640" height="1136" />
      <gap:splash src="img/splash/ios/Default-Landscape.png" width="1024" height="768" />
      <gap:splash src="img/splash/ios/Default-Portrait.png" width="768" height="1024" />
      <gap:splash src="img/splash/ios/Hi-Rez-Portrait.png" width="1536" height="2008" />
      <gap:splash src="img/splash/ios/Hi-Rez-Landscape.png" width="2048" height="1496" />
      

      Apple 的指导方针: http://developer.apple.com/library/ios/#documentation/userexperience/conceptual/mobilehig/IconsImages/IconsImages.html

      Phonegap Build 的指南:http://build.phonegap.com/docs/config-xml

      【讨论】:

      • 您好,谢谢,但问题是关于 Android 的 :) iOS Screenies 更容易安排。不过还是谢谢啦。
      【解决方案6】:

      这可能会满足您的需求。它让您可以在一个漂亮直观的界面中自定义和添加所有相关的config.xml 设置、图像和启动画面。

      我建议下载文件并手动安装。基于网络的空中安装程序似乎不起作用。

      http://aj-software.com/configap/index.html [当前离线]

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2019-03-22
        • 2017-04-16
        • 2014-10-12
        • 2016-04-19
        • 1970-01-01
        • 2022-01-16
        • 2014-09-20
        • 2016-05-04
        相关资源
        最近更新 更多