Android WebView offscreen/bitmap rendering issue
<p>I'd like to render an HTML fragment to a WebView and then grab a bitmap of it.  Here is a code fragment (which is inside of MainActivity.onCreate):</p>

<pre><code>final WebView view = new WebView(this);
String summary = "&lt;html&gt;&lt;body&gt;You scored &lt;b&gt;192&lt;/b&gt; points.&lt;/body&gt;&lt;/html&gt;";
view.loadData(summary, "text/html", null);
Bitmap bitmap= Bitmap.createBitmap(400, 400, Bitmap.Config.ARGB_8888);
Canvas offscreen = new Canvas(bitmap);
view.draw(offscreen);
</code></pre>

<p>When 'bitmap' is originally created, it is transparent.  During the 'view.draw' call, it is provided with an all-white background, but the HTML summary string is not rendered!</p>

<p>The exact same effect is obtained by the following:</p>

<pre><code>final WebView view = new WebView(this);
String summary = "&lt;html&gt;&lt;body&gt;You scored &lt;b&gt;192&lt;/b&gt; points.&lt;/body&gt;&lt;/html&gt;";
view.loadData(summary, "text/html", null);
Picture picture = new Picture();
Canvas picCanvas = picture.beginRecording(400, 400);
view.draw(picCanvas);
picture.endRecording();
Bitmap bitmap = Bitmap.createBitmap(400, 400, Bitmap.Config.ARGB_8888);
Canvas offscreen = new Canvas(bitmap);
offscreen.drawPicture(picture);
</code></pre>

<p>In both cases, the underlying bitmap is modified to show an all-white background, but nothing else.  Can anyone shed some light on why this is happening?  I'm using a Sony Experia Z3 running Android 6.0.1 API 23, if this matters.</p>