Android phonegap应用很慢

时间:2014-06-23 15:09:03

标签: android html5 cordova

我有一个html5 / phonegap应用程序。它在galaxy s3或s4上运行缓慢。

logcat显示它在这里和那里有2秒的延迟。以下是一些例子。

05-19 12:30:27.148: D/webkit(14438): euler: isUrlBlocked = false
05-19 12:30:29.390: D/dalvikvm(14438): GC_FOR_ALLOC freed 1641K, 22% free 26652K/33832K, paused 18ms, total 19ms

...
05-19 12:30:30.331: D/webkit(14438): euler: isUrlBlocked = false
05-19 12:30:33.024: V/chromium_net(14438): external/chromium/net/socket/ssl_client_socket_openssl.cc:419: [0519/123033:INFO:ssl_client_socket_openssl.cc(419)] ~SSLClientSocketOpenSSL()

有什么建议吗?或者以任何方式找出更多细节?

1 个答案:

答案 0 :(得分:0)

是的,我在开发第一个Android计算器时也遇到了同样的问题。 问题出在所有 CSS 上。如果你编写了很多 CSS 和很多参考文献。它会卡在里面。

或者您可以尝试使用内联方法编写所有 CSS 。和 JavaScript 一样,

<html>
<head>
<title>Html calculator</title>
<style type="text/css" >

    body{
        background-color: #A7A6CC;
    }

    #bt{
    height:80px;
    width:80px;
    font-size:40px;
    background:#8987BA;
    }

    #ans{
    height:50px;
    background:#8987BA;
    font-size: 30px;
    }

    #main{
    text-align:center;
    }
</style>
</head>
<body >
<table id="main" align="center">
<tr>
<td>
 <form name="calculator" >
<input id="ans" style="width: 320px;" type="textfield" name="ans" value="">
<br>
<input id="bt" type="button" value="1" onClick="document.calculator.ans.value+='1'">
<input id="bt" type="button" value="2" onClick="document.calculator.ans.value+='2'">
<input id="bt" type="button" value="3" onClick="document.calculator.ans.value+='3'">
<input id="bt" type="button" value="+" onClick="document.calculator.ans.value+='+'">
<br>
<input id="bt" type="button" value="4" onClick="document.calculator.ans.value+='4'">
<input id="bt" type="button" value="5" onClick="document.calculator.ans.value+='5'">
<input id="bt" type="button" value="6" onClick="document.calculator.ans.value+='6'">
<input id="bt" type="button" value="-" onClick="document.calculator.ans.value+='-'">
<br>
<input id="bt" type="button" value="7" onClick="document.calculator.ans.value+='7'">
<input id="bt" type="button" value="8" onClick="document.calculator.ans.value+='8'">
<input id="bt" type="button" value="9" onClick="document.calculator.ans.value+='9'">
<input id="bt" type="button" value="x" onClick="document.calculator.ans.value+='*'">
<br>
<input id="bt" type="button" value="0" onClick="document.calculator.ans.value+='0'">
<input id="bt" type="reset" value="Reset">
<input id="bt" type="button" value="=" onClick="document.calculator.ans.value=eval(document.calculator.ans.value)">
<input id="bt" type="button" value="&divide;" onClick="document.calculator.ans.value+='/'">
</form>
</td>
</tr>
</table>

</body>
</html>

Design of Code

然后它运作良好。 尝试更多提示。在

http://phonegap.com/blog/2013/07/25/tips-for-developing-apps-with-pg/

希望它会有所帮助。

相关问题