Android WebView 硬件加速键盘故障 [英] Android WebView Hardware Accelerated Keyboard Glitch
问题描述
当 WebView 被硬件加速时,点击输入字段会导致键盘出现并且 html 被重绘并移动复制了一会儿:
When WebView is hardware accelerated, clicking on input field causes keyboard to appear and html is redrawed shifted and duplicated for a moment:
1) 当软键盘出现时,WebView 将其内容平移到左下角,然后再回到正常位置.导致简短可见的重复.
1) When soft keyboard is appearing WebView pans its content to bottom-left, then againt to normal position. Causes short view-able duplication.
2) 更改键盘时(例如 abc->numbers)内容会按键盘高度向下平移,然后返回正常位置.导致简短可见的重复.
2) When changing keyboards (ex. abc->numbers) contents are panned down by keyboard height and then back to normal position. Causes short view-able duplication.
在两台 Android 4.0 平板电脑上测试,如果关闭硬件加速,则不会出现此类故障.
Tested on two Android 4.0 tablets, if hardware accelerations is turned off no such glitches appear.
我没有找到关于此的任何信息,有人遇到过同样的问题吗?
I failed to found any information on this, has anyone experienced same problem?
推荐答案
所以我终于找到了一些解决方案:
So I finally found some solutions:
整个 WebView 内容按布局边距宽度移动,因此将其设置为
0px
可以解决此问题.
android:windowSoftInputMode="adjustPan"
用于 WebView 活动.
android:windowSoftInputMode="adjustPan"
for WebView activity.
这篇关于Android WebView 硬件加速键盘故障的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!