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

webview recyclerview example
webview inside recyclerview scroll
android webview zoom to fit content
load url in webview android
android webview browser
android webview resize to fit content

In my Nougat device, webview inside RecyclerView is blank sometimes. When I scroll slowly and then go back to webview item content disappear. There is no issue on devices below Android N. Android N uses Chrome as the default browser for apps. So I thought there might be a bug in Chrome so I raise a bug in chrome portal as well. There are a couple of related question in SO but that didn't solve my problem. So is there a way in Android webview setting which can solve this problem? I have written detail description in the bug link.

Bug link: click here

My onBindViewHolder method code for WebView is

final VHItem vhItem = (VHItem) holder;


vhItem.webViewChild.loadData("<body>" + html + "</body>", "text/html;charset=utf-8", "utf-8");


html is the html string


They have fixed the issue. If you are still having the same problem try updating your Android chrome version to 61 or above.

For a start webview consumes memory because it load has to load and render html data. Rather than using a webview in a recycler view, I think it would be better if you implemented it either of these two ways:

  1. You handle the list of data in html and send it into the webview and remove the recycler view completely
  2. You draw the layout of the expected contents in xml and inflate it directly into the recyclerview and remove webview completed. (Note: you can inflate different views into a recycler depending on the adapter position and data at that position).

Using a webview might seem the easy way to implement whatever you are trying but trust me, the drawbacks outweight the benefit. So its just best to avoid it.

android, In my Nougat device, webview inside RecyclerView is blank sometimes. When I when a view(An item) exits your screen the same view is bought below just by​  fit - Webview inside RecyclerView is showing blank screen sometimes on Nougat devices only webview in recyclerview android (4) In my Nougat device, webview inside RecyclerView is blank sometimes.

WebView goes blank (white) after page loads in Android Driver , in nougat device, webview inside recyclerview blank sometimes. when scroll , go webview item content disappear. there no issue on devices  Using Recyclerview to show data from Firebase Database - Duration: 40:33. faiizii 58,595 views

I solved this problem by floating a WebView in a up layer of RecyclerView, meanwhile placing a HOLDER view in RecyclerView. And then I register an listener to the scroll event of RecyclerView. I Control the position and visibility of the floating WebView

Managing WebView objects, In the actual native browser (or any other browser) this does not happen. After creating an Android app with just a webview (with the same code as loadUrl(url​) on this and then returning true -- which caused the screen to turn blank. of url differently, as shown in my last comment (for "about:blank"). LetaiefAymen commented Feb 14, 2017. Hi :), i made a test with the demo-cat-gallery , if the RecyclerView is inside a ScrollView then no items are shown at all for devices with Api level 21 (maybe lower API too), it works on API level 24, and it's easily reproducible.

You can try this code in onCreateViewHolder

ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
                        WebView web = new WebView(parent.getContext());
                        String url="...";
                        WebSettings settings = web.getSettings();

                        holder = new ViewHolder(web);

Slow rendering, To use this method, add the logic shown in the following code snippet: (such as a Wear OS device), or lacks an updatable WebView implementation, when you may want to only enable Safe Browsing conditionally or disable it. This screen gives users the option to load the URL anyway or return to a  Question: Tag: android,webview,youtube Update. I have updated my question to hide confidential code. If still there is some confusion pls msg me in comments. Question. I have written an custom Webview for playing youtube video embedded in my website to go full Screen.

9 Android WebView Example tutorials that had gone way too far , Profile GPU Rendering displays bars on the screen that give you a quick Sometimes, jank can be reproduced only when the app is launched from a cold start. Although Systrace is a tool that shows what the entire device is doing, it can Inside Systrace, you can click on RecyclerView-traced sections to  The RecyclerView creates only as many view holders as are needed to display the on-screen portion of the dynamic content, plus a few extra. As the user scrolls through the list, the RecyclerView takes the off-screen views and rebinds them to the data which is scrolling onto the screen.

Questions for tag android-fullscreen, There may be occasions when you want to show a webpage to your Just put your URL as a string, Before that, we must provide Internet If you are testing webview code in devices which contains Android Sometimes You need to open your website links in webview and other links in external browsers. Android - WebView. WebView is a view that display web pages inside your application. You can also specify HTML string and can show it inside your application using WebView. WebView makes turns your application to a web application. In order to add WebView to your application, you have to add <WebView> element to your xml layout file.

Android Working with WebView, Get device screen height in React Native when Full Screen Gesture feature is enabled and the device have a Notch Show a dialog box fullscreen even after a EditText is focused Videoview is not displaying in nougat 24 but displaying and working in android Q 29 android webview fullscreen only works for first page. The Developer Preview for Android 11 is now available; test it out and share your feedback . If you want to deliver a web application (or just a web page) as a part of a client application, you can do it using WebView. The WebView class is an extension of Android's View class that allows you to display web pages as a part of your activity layout.

  • can you paste your onBindViewHolder(). or you complete adapter
  • @DigvijaySingh check my edited question.
  • this answer may helps you stackoverflow.com/a/2379054/5908465
  • WebView in RecyclerView is manageable if you implement an application scoped cache and create the WebView with application context. That way you don't have to reinitialize it on each scroll into viewport or each screen orientation change.
  • @EugenPechanec Can you elaborate a little?
  • Yes please can u tell more on how to manage webviews with application scope.