I want to set background image in a webview in android , so that whenever no page or url is load , it shows a background image in a webview.
2
- 3What you had tried so far to achieve this?SilentKiller– SilentKiller2014-09-18 12:02:30 +00:00Commented Sep 18, 2014 at 12:02
- Coulod u please check this, might this helpful to you stackoverflow.com/questions/10280406/…ajitksharma– ajitksharma2014-09-18 12:07:44 +00:00Commented Sep 18, 2014 at 12:07
Add a comment |
2 Answers
You can set background image in a webview by adding that line of code :
webView.setBackgroundResource(R.drawable.image_name); webView.setBackgroundColor(0x00000000); 1 Comment
Adil Hussain
Use
android.graphics.Color.TRANSPARENT instead of 0x00000000 for readability but otherwise this solved my problem!webView.setBackgroundColor(0x00000000); //<-- Color to transparent webView.setBackgroundResource(R.drawable.backgroundImage); 1 Comment
Adil Hussain
Use
android.graphics.Color.TRANSPARENT instead of 0x00000000 for readability but otherwise this solved my problem!