1

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
  • 3
    What you had tried so far to achieve this? Commented Sep 18, 2014 at 12:02
  • Coulod u please check this, might this helpful to you stackoverflow.com/questions/10280406/… Commented Sep 18, 2014 at 12:07

2 Answers 2

16

You can set background image in a webview by adding that line of code :

webView.setBackgroundResource(R.drawable.image_name); webView.setBackgroundColor(0x00000000); 
Sign up to request clarification or add additional context in comments.

1 Comment

Use android.graphics.Color.TRANSPARENT instead of 0x00000000 for readability but otherwise this solved my problem!
2
webView.setBackgroundColor(0x00000000); //<-- Color to transparent webView.setBackgroundResource(R.drawable.backgroundImage); 

1 Comment

Use android.graphics.Color.TRANSPARENT instead of 0x00000000 for readability but otherwise this solved my problem!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.