Bizarre Error related to Webview in Android App

拜拜、爱过 提交于 2020-01-07 03:00:13

问题


I have a string that I am fetching from a JSON response, the string is as follows:

\u003cp\u003e\u003c/p\u003e\u003cdiv style=\"text-align: center;\"\u003e\r\n\u003cdiv\u003e\u003cimg src=\"http://8wayrun.com/rectangle.png\" alt=\"\" style=\"cursor: default;\"\u003e\u003c/div\u003e\r\n\u003cbr\u003e\r\n\u003cdiv\u003eThis is the central hub for many of the tournaments run on the 8WAYRUN.TV live stream.\u003c/div\u003e\r\n\u003cdiv\u003eYou can find our live stream at: \u003ca href=\"http://8wayrun.tv/\" rel=\"nofollow\"\u003ehttp://8wayrun.tv\u003c/a\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003cdiv style=\"text-align: center;\"\u003e\r\n\u003c/div\u003e\r\n

This text is put in the string description.

I am then adding this text to a webview as follows:

    WebView desc = (WebView) view.findViewById(R.id.desc);
    desc.loadData(desciption, "text/html", "UTF-8");
    desc.setBackgroundColor(Color.TRANSPARENT);

However, running this code produces a bizarre error: it doens't crash the program or anything, but I would like to know why its happening, and possibly fix it:

E/libEGL: validate_display:255 error 3008 (EGL_BAD_DISPLAY)

W/cr_BindingManager: Cannot call determinedVisibility()
     - never saw a connection for the pid: 17634

回答1:


WebView doesn't support transparent background with hardware acceleration, you need to turn it off. See:

How to get transparent background of webView for 4.0 version

How to make Android Webview Background Transparent at KITKAT(4.4)

But note that non-accelerated WebView will render and scroll slower. You might consider not using a transparent WebView.



来源:https://stackoverflow.com/questions/35144629/bizarre-error-related-to-webview-in-android-app

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