tre*_*der 10 landscape splash-screen cordova phonegap-build
我应该输入config.xml什么或者我应该做些什么,让AndroidG设备上的PhoneGap Build应用程序的启动屏幕在横向模式下正确显示?
PhoneGap Build(用于编译)docs/blog对此一无所知.只有Portrait适用于Android.
由于first(docs)说使用height并且width支持跨平台,我尝试使用它:
<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" />
Run Code Online (Sandbox Code Playgroud)
但是没有效果 - 在我的Android设备上的横向模式中,我总是看到我的启动画面的strechead portait模式版本.
根据我目前的知识和深入研究,我发现这是一个确认的错误,我们目前无法做任何事情.
PhoneGap Build(也可能是PhoneGap本身)目前根本不支持横向闪屏.我甚至尝试过iOS方式(如问题所示 - 使用width和heightparams,官方不支持Android).但它仍然无效.
在肖像模式下一切都很好,但无论你使用什么屏幕密度的Android设备 - 在风景中你都会看到丑陋的变形肖像版的启动画面.
我没有使用PhoneGap Build,但我设法在一个基本的PhoneGap Android应用程序中解决了这个问题.
假设您有两个不同的初始图像 - 横向图像和纵向版本 - 并且您希望它们都可以拉伸以填充可用的屏幕区域.
把一个在drawable和其他的drawable-land.(或者drawable-land-hdpi,drawable-land-xhdpi等等,如果您有多种尺寸.)
接下来,确保您自己管理配置更改AndroidManifest.xml:
<activity
...
android:configChanges="orientation|screenSize|keyboardHidden"
...
>
</activity>
Run Code Online (Sandbox Code Playgroud)
然后将它放在扩展的主Activity类中DroidGap.java:
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
if (super.splashDialog != null) {
ViewGroup rootView = (ViewGroup) super.splashDialog.getWindow()
.getDecorView().findViewById(android.R.id.content);
LinearLayout linearLayout = (LinearLayout) rootView.getChildAt(0);
// manually refresh the splash image
linearLayout.setBackgroundDrawable(null);
linearLayout.setBackgroundResource(R.drawable.mysplash);
}
}
Run Code Online (Sandbox Code Playgroud)
这将导致背景图像重绘并在用户更改方向时正确拉伸.
| 归档时间: |
|
| 查看次数: |
5580 次 |
| 最近记录: |