Android的web视图渲染不正确 [英] Android webview not rendering correctly
问题描述
我已经显现一些网页与网页视图的时候一直有一个奇怪的错误。我已经使用三星平板型号SGH时,发现了这个问题 - I957运行蜂窝3.1(Android和其他设备的previous版本,我还没有看到这个问题)
问题形象化具有输入字段(用户名或密码)页时发生。当这些inputfields的pressing几次之一,该页面变为黑色,只留下inputfield'正确'可视化。但是,试图滚动视图时,页面恢复正常可视化,犹如滚动造成的观点正确呈现自己。
我已经试过这两个网站:Facebook和Twitter
要重现此问题,它足以与网页视图(使用Web视图客户端)一个简单的活动。启用javascript。
的WebView =(的WebView)findViewById(R.id.webview);webview.setWebViewClient(新WebViewClient(){
@覆盖
公共布尔shouldOverrideUrlLoading(的WebView视图,字符串URL){
view.loadUrl(URL);
返回false;
}
});webview.getSettings()setJavaScriptEnabled(真)。
webview.loadUrl(http://m.facebook.com/);
我与运行3.x的一个三星平板同样的问题,得到它的工作能够在AndroidManifest.xml中的硬件加速。
的android:hardwareAccelerated =真
I have been having a strange error when visualizing some pages with a webview. I have found this problem when using a Samsung Tablet model SGH - I957 running Honeycomb 3.1 (On previous versions of android and other devices, I haven't seen this problem).
The problem happens when visualizing pages which have input fields (Username or password). When pressing several times one of these inputfields, the page turns to black, leaving just the inputfield 'correctly' visualized. But when trying to scroll the view, the page visualizes normally again, as if scrolling caused the view to correctly render itself.
I have tried this on two sites: Facebook and Twitter
To reproduce this problem it's enough to have a simple activity with a webview (with web view client). javascript is enabled.
webview = (WebView) findViewById(R.id.webview);
webview.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return false;
}
});
webview.getSettings().setJavaScriptEnabled(true);
webview.loadUrl("http://m.facebook.com/");
I got the same problem with a samsung tablet running 3.x and got it working enabling hardware acceleration in AndroidManifest.xml.
android:hardwareAccelerated="true"
这篇关于Android的web视图渲染不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!