Android阻止屏幕关闭

Android阻止屏幕关闭,android,jquery-mobile,screen,Android,Jquery Mobile,Screen,所以我看到,您可以创建一个xml,它可以像这样进行线性布局: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:keepScreenOn="true"> &

所以我看到,您可以创建一个xml,它可以像这样进行线性布局:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="fill_parent"
    android:layout_height="fill_parent" android:keepScreenOn="true">
</LinearLayout>

我的问题是:我正在做一个jQuery移动应用程序,我想我可以把它放在我的web.xml文件中。然而,当我尝试这样做时,我总是会出错。这是我的web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

<!-- The definition of the Root Spring Container shared by all Servlets 
    and Filters -->
<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/spring/root-context.xml,
        /WEB-INF/spring/appServlet/security-context.xml</param-value>
</context-param>

<!-- Creates the Spring Container shared by all Servlets and Filters -->
<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
    <listener-class>org.springframework.security.web.session.HttpSessionEventPublisher</listener-class>
</listener>
<!-- Processes application requests -->
<servlet>
    <servlet-name>appServlet</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>appServlet</servlet-name>
    <url-pattern>/</url-pattern>
</servlet-mapping>
<filter>
    <filter-name>springSecurityFilterChain</filter-name>
    <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
    <filter-name>springSecurityFilterChain</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

上下文配置位置
/WEB-INF/spring/root-context.xml,
/WEB-INF/spring/appServlet/security-context.xml
org.springframework.web.context.ContextLoaderListener
org.springframework.security.web.session.HttpSessionEventPublisher
appServlet
org.springframework.web.servlet.DispatcherServlet
上下文配置位置
/WEB-INF/spring/appServlet/servlet-context.xml
1.
appServlet
/
springSecurityFilterChain
org.springframework.web.filter.DelegatingFilterProxy
springSecurityFilterChain
/*

有没有更简单的方法使我的Android平板电脑在我使用web应用程序时不会关闭屏幕?正如我所说,我尝试将LinearLayout代码放入我的web.xml中,但它给了我大量的错误。谢谢

有没有更简单的方法使我的Android平板电脑在我使用web应用程序时不会关闭屏幕

这是不可能的。事实上,如果一个任意的网站能够以这种方式影响一台设备,那将是非常令人不安的


如果你选择创建一个本地应用程序,或者甚至是一个PosiGAP应用程序,那么你可以考虑尝试控制屏幕是否关闭。

线性布局是针对Android布局文件,而不是针对服务器端Web.xml文件。你是否在试图找到一个网页上的代码,告诉浏览器不要让手机关机?这就是你的想法。他们将使用蓝牙扫描仪扫描条形码,目前效果良好。但是,该应用程序无法将扫描识别为实际的屏幕活动,因为他们没有触摸它,因此它会在大约一分钟后关闭。Javascript代码可以从本机移动应用程序接口,这是我知道的唯一可以让网页与设备交互的方法。我刚刚决定调整设备本身的睡眠时间设置。我们提供所有的平板电脑,Surefox将它们与其他任何东西隔离,因此这样做更容易。谢谢你的帮助。