android - Webview inside RecyclerView is showing blank screen sometimes on Nougat devices only -


in nougat device, webview inside recyclerview blank sometimes. when scroll , go webview item content disappear. there no issue on devices below android n. android n uses chrome default browser apps. thought there might bug in chrome raise bug in chrome portal well. there couple of related question in didn't solve problem. there way in android webview setting can solve problem? have written detail description in bug link.

bug link: click here

my onbindviewholder method code webview is

final vhitem vhitem = (vhitem) holder;  vhitem.webviewchild.getsettings().setusewideviewport(false); vhitem.webviewchild.getsettings().setjavascriptenabled(true);  vhitem.webviewchild.loaddata("<body>" + html + "</body>", "text/html;charset=utf-8", "utf-8"); 

where

html html string

for start webview consumes memory because load has load , render html data. rather using webview in recycler view, think better if implemented either of these 2 ways:

  1. you handle list of data in html , send webview , remove recycler view completely
  2. you draw layout of expected contents in xml , inflate directly recyclerview , remove webview completed. (note: can inflate different views recycler depending on adapter position , data @ position).

using webview might seem easy way implement whatever trying trust me, drawbacks outweight benefit. best avoid it.


Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -