我目前正在编写一个应用程序,它使用嵌入式 WebView 来显示其内容,或者有时使用输入表单从用户那里查询数据。这些表单中的输入字段使用 -webkit-css 样式设置样式。
到目前为止,这在所有设备(在 Nexus One、LG Optimus 500、Samsung Galaxy S 上测试)上都可以正常工作,但带有 HTC Sense 的设备除外。在带有 HTC Sense 的设备上,如果输入元素被选中,样式会丢失。在 css 中使用input:focus {}
没有帮助,带有 Sense 的 HTC 设备只是忽略。
这张图片说明了这一点,“昵称”当前已被选中,但仍应采用与“Vorname”和“Nachname”相同的方式设置样式。
有什么想法可以解决这个问题吗?
这是一个示例 HTML 页面(根据要求):
<html>
<head>
<meta name="viewport" content="target-densitydpi=low-dpi" />
<style type="text/css">
input[type="number"],
input[type="text"]{
border: 1px solid #CDFF3C;
background: #F3FECA;
width: 220px;
-webkit-border-radius: 4px;
-webkit-box-shadow: inset 1px 1px 4px #AAA;
-webkit-tap-highlight-color: rgba(205, 255, 60, 0.5);
}
body {
background:#ebffb9;
margin-right:0;
margin-left:0;
font-size: 14px;
}
</style>
</head>
<body>
<form name="data" action="/im/postdata" method="get" accept-charset="UTF-8">
<p class="edit">
<b>Vorname</b>
<br/>
<input type="text" name="3"/>
</input>
</p>
</form>
</body>
</html>
无需将其嵌入到应用程序中,只需将其放在某处的网络服务器上,然后使用内置的网络浏览器打开它。