使用Cordova全屏显示Android应用 [英] Making an Android app fullscreen with Cordova

查看:257
本文介绍了使用Cordova全屏显示Android应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Cordova的新手,我试图建立一个全屏显示的应用程序(隐藏Android底部的任务栏)。

I'm a newcomer to Cordova, and am trying to make an app that appears full screen (hiding the taskbar at the bottom of Android).

我已经看过网上,似乎有两种不同的技巧....我试过添加

I have looked online and there seem to be two different techniques.... I have tried adding

<preference name="Fullscreen" value="true" /> to my config.xml

,以便读取

<?xml version='1.0' encoding='utf-8'?>
<widget id="io.cordova.hellocordova" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <preference name="loglevel" value="DEBUG" />
    <preference name="AndroidLaunchMode" value="singleTop" />
    <feature name="App">
        <param name="android-package" value="org.apache.cordova.App" />
    </feature>
    <name>HelloCordova</name>
    <description>
        A sample Apache Cordova application that responds to the deviceready event.
    </description>
    <author email="dev@cordova.apache.org" href="http://cordova.io">
        Apache Cordova Team
    </author>
    <content src="index.html" />
    <access origin="*" />
    <preference name="Fullscreen" value="true" />
    <preference name="WebViewBounce" value="true" />
    <preference name="Orientation" value="landscape" />
    <preference name="HideKeyboardFormAccessoryBar" value="true" />
</widget>

状态栏仍然保留在底部(虽然应用程序固定在横向)。我也试过其他的建议,包括添加行到hellocordova.java。这进口android.view.WindowManager;然后在加载index.html之后添加行:

The status bar still remains at the bottom (although the app does fix at landscape). I have also tried the other advice which involves adding lines to hellocordova.java. This imports android.view.WindowManager; and then adds lines after loading index.html:

(WindowManager.LayoutParams.FLAG_FULLSCREEN,                   WindowManager.LayoutParams.FLAG_FULLSCREEN WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);

此方法停止应用程序与cordova build android编译。

This method stops the app from compiling with cordova build android.

我可以看到的任何提示。

Any tips of where I can be looking.

我使用的是Android 4.1.1

I'm using Android 4.1.1

推荐答案

bar在Android上被称为导航栏,你正在寻找的模式称为沉浸式模式。这些条款可能会帮助您进行未来的网络搜索。
尝试使用此插件
https://github.com/mesmotronic/cordova -fullscreen-plugin

The bottom bar on Android is called the Navigation Bar and the mode you are looking for is called Immersive Mode. Those terms may help you with future web searches. Try using this plugin https://github.com/mesmotronic/cordova-fullscreen-plugin

这篇关于使用Cordova全屏显示Android应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆