Android webview not rendering correctly

房东的猫 提交于 2019-12-11 03:49:31

问题


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/");

回答1:


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"


来源:https://stackoverflow.com/questions/8760003/android-webview-not-rendering-correctly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!