Cordova PhoneGap构建中Android的横向启动屏幕

Cordova PhoneGap构建中Android的横向启动屏幕,cordova,landscape,phonegap-build,splash-screen,Cordova,Landscape,Phonegap Build,Splash Screen,我应该在config.xml中输入什么,或者通常我应该做什么,以便在Android设备上以横向模式正确显示PhoneGap构建应用程序的启动屏幕 PhoneGap构建(用于编译)/对此没有任何内容。安卓系统只覆盖肖像 因为first(docs)说使用高度和宽度是跨平台支持的,所以我尝试使用它: <gap:splash src="res/splash-200x320-android.png" gap:platform="android" gap:density="ld

我应该在
config.xml
中输入什么,或者通常我应该做什么,以便在Android设备上以横向模式正确显示PhoneGap构建应用程序的启动屏幕

PhoneGap构建(用于编译)/对此没有任何内容。安卓系统只覆盖肖像

因为first(docs)说使用
高度
宽度
是跨平台支持的,所以我尝试使用它:

<gap:splash src="res/splash-200x320-android.png"             gap:platform="android" gap:density="ldpi"  width="200" height="320" />
<gap:splash src="res/splash-320x480-android-bada-ios.png"    gap:platform="android" gap:density="mdpi"  width="320" height="480" />
<gap:splash src="res/splash-480x800-android-bada-wp.png"     gap:platform="android" gap:density="hdpi"  width="480" height="800" />
<gap:splash src="res/splash-720x1280-android.png"            gap:platform="android" gap:density="xhdpi" width="720" height="1280" />
<gap:splash src="res/splash-320x200-android.png"             gap:platform="android" gap:density="ldpi"  width="320" height="200" />
<gap:splash src="res/splash-480x320-android-bada-ios.png"    gap:platform="android" gap:density="mdpi"  width="480" height="320" />
<gap:splash src="res/splash-800x480-android-bada-wp.png"     gap:platform="android" gap:density="hdpi"  width="800" height="480" />
<gap:splash src="res/splash-1280x720-android.png"            gap:platform="android" gap:density="xhdpi" width="1280" height="720" />


但是没有效果——在我的Android设备上,在横向模式下,我总是看到我的闪屏上有一个糟糕的strechead portait模式版本。

根据我目前的知识,经过深入研究,我发现这是一个已确认的错误,我们目前对此无能为力

PhoneGap构建(可能还有PhoneGap本身)目前根本不支持横向启动屏幕。我甚至尝试了iOS方式(如问题中所示——使用
width
height
params,Android官方不支持)。但它仍然不起作用


在纵向模式下一切都很好,但无论您使用的Android设备的屏幕密度如何——在横向模式下,您将看到丑陋变形的纵向版本的闪屏。

我没有使用PhoneGap构建,但我在一个基本的PhoneGap Android应用程序中解决了这一问题

假设您有两个不同的启动图像-横向和纵向版本-您希望它们都拉伸以填充可用的屏幕区域

将一个放置在
drawable
中,另一个放置在
drawable land
中。(如果您有多个尺寸,则可以使用
可绘制焊盘hdpi
可绘制焊盘xhdpi
等。)

接下来,确保您自己在
AndroidManifest.xml
中管理配置更改:


然后将其放入扩展了DroidGap.java的主活动类中:

@覆盖
公共无效OnConfiguration已更改(配置newConfig){
super.onConfigurationChanged(newConfig);
如果(super.splashDialog!=null){
ViewGroup rootView=(ViewGroup)super.splashDialog.getWindow()
.getDecorView().findViewById(android.R.id.content);
LinearLayout LinearLayout=(LinearLayout)rootView.getChildAt(0);
//手动刷新飞溅图像
线性布局。可缩进地面绘制(空);
线性布局。挫折背景资源(R.drawable.mysplash);
}
}

当用户改变方向时,这将导致背景图像重新绘制并适当拉伸。

Phonegap构建现在使用。指定密度时,附加
端口-
陆地-
以指定纵向或横向:

<splash src="portrait-ldpi.png" density="port-ldpi"/>
<splash src="landscape-ldpi.png" density="land-ldpi"/>

有关详细信息,请参阅和文章。

这是一个好看的解决方案(so+1),但我不会接受它,因为它太离题了。我的问题的想法是为PhoneGap构建带来特定的答案——也就是说,只使用HTML/Javascript和
config.xml
。你没有能力在PhoneGap构建应用程序中使用纯Java代码,不是吗?@LarryAasen不,你不能!阅读我的评论。我说的是建立电话鸿沟。使用(在云中构建)时,您仅限于HTML/Javascript。如果要在自己的环境中本地生成,则只能使用纯Java代码。@trejder如果是这种情况,您需要重新表述您的问题以包括生成。否则,我的评论是正确的。@LarryAasen我在我的问题中使用了:PhoneGap构建(用于编译)部分,也是答案的作者,你在评论(nlawson)的答案开头是:我没有使用PhoneGap构建,但是。。。。似乎大多数人都明白,这个问题只是关于PhoneGap构建的。但是,如果这能让你们高兴的话,我认为更改问题的标题没有问题!:]
<gap:splash src="portrait-xxhdpi.png" gap:platform="android" gap:qualifier="port-xxhdpi" />
<gap:splash src="landscape-xxhdpi.png" gap:platform="android" gap:qualifier="land-xxhdpi" />