1

I developing a browser using webview to load url,mostly showing perfect. but some unexpected.some titles display at wrong place. like below.

My browser enter image description here

Other Browser enter image description here

as you can see.on other browser.it running perfectly.so there must something i lost.

and this is my webview settings

    WebSettings settings = webView.getSettings();
    settings.setRenderPriority(RenderPriority.HIGH);
    settings.setJavaScriptEnabled(true);//设置WebView是否可以运行JavaScript
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        settings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
    }

    settings.setLoadWithOverviewMode(true);//设置适应屏幕
    settings.setUseWideViewPort(true);//设置适应屏幕
    settings.setDomStorageEnabled(true);//DOM缓存

    settings.setJavaScriptCanOpenWindowsAutomatically(true);//设置WebView是否可以由JavaScript自动打开窗口,默认为false,通常与JavaScript的window.open()配合使用
    settings.setSupportMultipleWindows(true);//设置WebView是否支持多窗口
    settings.setSupportZoom(true);//设置是否支持缩放
    settings.setBuiltInZoomControls(true);//显示或不显示缩放按钮(wap网页不支持)
    settings.setAllowFileAccess(true);//启用或禁用WebView访问文件数据
    settings.setPluginState(WebSettings.PluginState.ON);

who can tell how to fix this.

floatingmuseum
  • 958
  • 8
  • 12

1 Answers1

0

If you have problem only with specific url, which language is other than english, then try the following

settings.setDefaultTextEncodingName("utf-8");  

Let me know if it works.

Mithun Sarker Shuvro
  • 3,902
  • 6
  • 32
  • 64