简体   繁体   English

PhoneGap Build - 为 Android 设备设置闪屏

[英]PhoneGap Build - Set splash-screen for Android devices

I'm currently trying to set an splash-screen for Android devices in PhoneGap build.我目前正在尝试在 PhoneGap 构建中为 Android 设备设置启动画面。 I set 4 different screens, but somehow the screens get deformed and lost their aspect ratio.我设置了 4 个不同的屏幕,但不知何故屏幕变形并失去了宽高比。 Is there a way to prevent that?有没有办法防止这种情况?

Do'h, missing that the question was about Android, here is the Android section from my config.xml: 不,错过了关于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" />-->

Yes, Apple is much easier! 是的,Apple更容易! On Android they go by qualifier called "densities". 在Android上,他们通过称为“密度”的限定符。

To my knowledge PhoneGap Build only supports three of the four right now. 据我所知,PhoneGap Build现在只支持四个中的三个。 ldpi, mdpi, hdpi and NOT xdpi (that is why it is commented out above). ldpi,mdpi,hdpi和NOT xdpi(这就是上面注释掉的原因)。

All Android devices will use one of these four sizes, is my understanding. 所有Android设备都将使用这四种尺寸中的一种,是我的理解。 Obtaining perfect aspect ratio across hundreds of different devices may be a little challenging, but with this you at least get close . 在数百种不同的设备上获得完美的宽高比可能有点挑战性,但是至少要靠近这一点。

Read this, I know it is a lot, but worth the reading: http://developer.android.com/guide/practices/screens_support.html#support 阅读本文,我知道它很多,但值得一读: http//developer.android.com/guide/practices/screens_support.html#support

And, the PGB Guidelines: http://build.phonegap.com/docs/config-xml 而且,PGB指南: http ://build.phonegap.com/docs/config-xml

we can set this in three ways 我们可以用三种方式设置它

  1. through config.xml 通过config.xml
  2. through the activity class setting the property 通过活动类设置属性
  3. through script 通过脚本

to refer more sample source code sample source code with example for phonegap-build-set-splash-screen 使用phonegap-build-set-splash-screen的示例来引用更多示例源代码示例源代码

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

请参阅Phonegap中phonegap @ Splash Screen的Splash屏幕详细信息

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);


}
}

this will help u to show splash screen using phonegap 这将有助于您使用phonegap显示启动画面

This is how I have them my PGB config.xml (your folder structure and file names will vary), this supports most IOS devices I believe. 这就是我的PGB config.xml(你的文件夹结构和文件名会有所不同),这支持我认为的大多数IOS设备。 How many launch images do you have? 你有多少张发布图片?

<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's guidlines: http://developer.apple.com/library/ios/#documentation/userexperience/conceptual/mobilehig/IconsImages/IconsImages.html Apple的指导: http//developer.apple.com/library/ios/#documentation/userexperience/conceptual/mobilehig/IconsImages/IconsImages.html

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

This will probably meet your needs. 这可能会满足您的需求。 It lets you customise and add all the relevant config.xml setting, images and splashscreens in a nice intuitive interface. 它允许您在一个漂亮的直观界面中自定义和添加所有相关的config.xml设置,图像和启动画面。

I recommend downloading the file and installing manually. 我建议下载文件并手动安装。 The web based air installer doesnt seem to work. 基于Web的空中安装程序似乎不起作用。

http://aj-software.com/configap/index.html http://aj-software.com/configap/index.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM