我有一个带有一些文本输入的网页。 Android 浏览器(至少在我现在所拥有的 Android 2.3.4 上)似乎覆盖了它自己对焦点页面上的输入的控制。
问题是覆盖的控件是一个白色的矩形,看起来很难看。有没有办法禁用它,或者以某种方式设置它?
更新:
以下是 Android 模拟器中的示例:
圆 Angular 和背景丢失。在实际设备上,我什至看不到控件周围的边框。
我应该提到我正在使用 jQuery Mobile。我的测试设备是 HTC Evo 4G。
相关问题:
Input has different style on focus
Input-Elements in WebViews always have the same style if highlighted on HTC Devices
最佳答案
最后,我为 Android 2.3 设备解决了这个问题。
无法真正移除叠加层,但可以将叠加层移到视口(viewport)之外。
叠加层尝试将自身定位到与输入字段相同的位置。 它复制您使用
分配的宽度和位置偏移量position:relative
和
top:-10000px
但覆盖不会复制通过
分配的位置偏移量-webkit-transform: translate3d()
这会导致 iScroll 等 JS 库出现一些问题。
但这也有助于我们隐藏叠加层:
input[type="password"], input[type="text"]{
position:relative;
top:-10000px;
-webkit-transform: translate3d(0, 10000px, 0);
}
您将输入字段放置在视口(viewport)之外。覆盖将自己定位在它旁边。现在您使用 translate3d() 将其移动到旧位置。
我们已经在我们的移动网络框架“qooxdoo Mobile”中使用了这个解决方案: http://demo.qooxdoo.org/devel/mobileshowcase/index.html#%2Fform
关于android - 禁用 Android 浏览器的输入覆盖?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9423101/