Setting webview background image to a resource graphic in Android
29,175
Solution 1
It will work perfectly, if you do something like this:
webView.setBackgroundColor(Color.TRANSPARENT);
webView.setBackgroundResource(R.drawable.your_image);
Solution 2
If not working on Android 3.1, try fix the AndroidManifest.xml:
android:hardwareAccelerated="false"
Author by
Admin
Updated on June 18, 2020Comments
-
Admin almost 4 years
I'm trying to set the background of a webview to a drawable image resource in Android.
From the sdk it seems something like this would work but it doesn't.
WebView web = (WebView) findViewById(R.id.webView); web.setBackgroundResource(R.drawable.backgroundmain); web.loadData(profile, "text/html", "UTF-8");
Any idea's?