我有一个使用adobe phonegap-build创建的phonegap应用程序,我有2个非常难的简单问题!修复。
似乎我所做的一切,只是做得不好。
1)在android中我希望应用程序全屏(没有“主页”,“返回”,“多窗口”栏),全屏!
2)我希望应用程序只是风景,这是大部分时间,但是在开始的几秒钟(进入应用程序时),方向是纵向的,只有在它修复了一些之后,根本不是一个好的行为
这是我的cordova config.xml中的代码:
<preference name="orientation" value="landscape" />
<preference name="screen-orientation" value="landscape" />
<preference name="permissions" value="none" />
<preference name="target-device" value="universal" />
<preference name="fullscreen" value="true" />
<preference name="webviewbounce" value="true" />
<preference name="prerendered-icon" value="true" />
<preference name="stay-in-webview" value="false" />
<preference name="ios-statusbarstyle" value="black-opaque" />
<preference name="detect-data-types" value="true" />
<preference name="exit-on-suspend" value="false" />
<preference name="show-splash-screen-spinner" value="true" />
<preference name="auto-hide-splash-screen" value="true" />
<preference name="disable-cursor" value="false" />
<preference name="android-minSdkVersion" value="7" />
<preference name="android-installLocation" value="auto" />
<preference name="Fullscreen" value="true" />
<preference name="EnableViewportScale" value="true" />
<preference name="DisallowOverscroll" value="true" />
<preference name="UIWebViewBounce" value="false" />
<preference name="AutoHideSplashScreen" value="false" />
<preference name="SplashScreenDelay" value="10000" />
我还有一个处理屏幕锁定的插件:
<gap:plugin name="net.yoik.cordova.plugins.screenorientation" version="1.3.1" />
在iphone上一切都很棒,但在android中,我该如何解决这些问题呢?
也许这会有所帮助?
http://docs.build.phonegap.com/en_US/configuring_config_file_element.md.html
http://stackoverflow.com/questions/4675750/lock-screen-orientation-android
为了更好地理解上传到phonegap构建的程序的结构:
-css
-img
-js
-lib (libraries like angular,jquery and such)
-modules (all the html here)
-res (icons and screen for splash and such)
-spec (tests)
application.js (my all javascript minified here)
config.xml
icon.png
index.html
spec.html
splash.png
所有这些文件每次都被压缩,并上传到phonegap-build
答案 0 :(得分:1)
尝试解决第一个问题,可以禁用底栏,您必须为此活动设置 SYSTEM_UI_FLAG_HIDE_NAVIGATION ,它可以在本机代码中使用,或者,似乎可以使用此{ {3}}
按照plugin,我通过将此代码添加到应用程序的起始点,以最简单快速和简单的方式使用它:
<preference name="Fullscreen" value="true" />
<preference name="Orientation" value="landscape" />
对于第二个问题,这似乎是一个常见问题,在 config.xml 中只有这个首选项的干净应用程序:
@Override
public void onCreate(Bundle savedInstanceState)
{
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
super.onCreate(savedInstanceState);
super.init();
// Set by <content src="index.html" /> in config.xml
loadUrl(launchUrl);
}
它非常完美,可能是启动画面或其他偏好会影响您的项目。 您可以尝试检查文件 platforms / android / AndroidManifest.xml 中的活动是否具有在横向模式下工作的所有属性,如果是这样的话......您可以将此代码添加到 onCreate 中的> MainActivity.java ,在 super.onCreate(savedInstanceState)之前; :
td
通过这种方式,我们尝试对 config.xml 中首选项实现的相同功能进行编码。