URL 未在 android 5.0 以下版本中打开,但使用 web view 在 5.1.1 中工作.4.4.2 中显示的是空白屏幕,而不是网页查看页面 [英] URL is not opening in below android 5.0 version but working in 5.1.1 using web view . Instead of web view page , blank screen is showing in 4.4.2

查看:30
本文介绍了URL 未在 android 5.0 以下版本中打开,但使用 web view 在 5.1.1 中工作.4.4.2 中显示的是空白屏幕,而不是网页查看页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Web 视图 URL 在 android 5.1.1 中工作正常,但在 4.4.2 版本中无法正常工作,仅显示空白屏幕.这是我的代码

Web view URL is working fine in android 5.1.1 but not in 4.4.2 version , its displaying blank screen only. Here is my code

public class WebViewTwo extends Activity {
WebView webView;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.web_view_two);
    webView = (WebView)findViewById(R.id.webView2);
    WebSettings webSettings = webView.getSettings();
    webSettings.setJavaScriptEnabled(true);
    webView.getSettings().setLoadsImagesAutomatically(true);
    webView.getSettings().setBuiltInZoomControls(true);
    webView.setWebViewClient(new WebViewClient());
    webView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
    webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
    webView.getSettings().setPluginState(WebSettings.PluginState.ON);
    webView.setWebChromeClient(new WebChromeClient());
    webView.loadUrl("www.google.co.in");
}

这是我的 logcat 错误

Here is my logcat error

07-21 12:26:13.053    2089-2104/com.ccc.dar E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000b44
07-21 12:26:13.064    2089-2104/com.ccc.dar E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000bd0
07-21 12:26:13.167    2089-2104/com.ccc.dar E/eglCodecCommon﹕ **** ERROR unknown type 0x79edaef5 (glSizeof,72)
07-21 12:26:13.184    2089-2104/com.ccc.dar E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000b44
07-21 12:26:13.194    2089-2104/com.ccc.dar E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000bd0
07-21 12:26:13.214    2089-2096/com.ccc.dar W/art﹕ Suspending all threads took: 22.429ms
07-21 12:26:13.238    2089-2104/com.ccc.dar E/eglCodecCommon﹕ **** ERROR unknown type 0x79edaef5 (glSizeof,72)
07-21 12:26:13.435    2089-2104/com.ccc.dar E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000b44
07-21 12:26:13.457    2089-2104/com.ccc.dar E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000bd0
07-21 12:26:13.499    2089-2101/com.ccc.dar I/art﹕ Background sticky concurrent mark sweep GC freed 1125(118KB) AllocSpace objects, 1(16KB) LOS objects, 0% free, 5MB/5MB, paused 2.405ms total 145.580ms
07-21 12:26:13.584    2089-2104/com.ccc.dar E/eglCodecCommon﹕ **** ERROR unknown type 0x79edaef5 (glSizeof,72)
07-21 12:26:44.980    2089-2096/com.ccc.dar W/art﹕ Suspending all threads took: 11.554ms

推荐答案

经过研究我得到了答案,现在它在 4.4.2 上顺利运行.

After research I got my answer and now its running smoothly on 4.4.2.

public class WebViewTwo extends Activity {

@Override
public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.web_view_two);

    WebView webView = (WebView) findViewById(R.id.webView2);
    webView.getSettings().setJavaScriptEnabled(true);
    webView.setWebViewClient(new HelloWebViewClient());

    webView.loadUrl("http://www.google.co.in");
}

private class HelloWebViewClient extends WebViewClient {
    @Override
    public boolean shouldOverrideUrlLoading(WebView view, String url) {

        view.loadUrl(url);
        return true;
    }
}}

这篇关于URL 未在 android 5.0 以下版本中打开,但使用 web view 在 5.1.1 中工作.4.4.2 中显示的是空白屏幕,而不是网页查看页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆