Thomas Besnehard
Thomas Besnehard

Reputation: 2095

android css background-image not found

I'm trying to use a image texture for my webpage body background. My webpage is shown in an Android webview.

Here is my CSS :

body
{
    font-family: helvetica;
    font-size: 12px;
    color: #555555;
    padding: 10px;
    /*background-color:#000000;*/
    background-image:url(bg_header_sample.png);
}

the css is inside an HTML file named Template.html. both Template.html and bg_header_sample.png are in the same assets folder : assets/global.

If I un-comment the background-color:#000000; line my body turn to black as wanted.

but with the current CSS my body stay transparent ...

Upvotes: 3

Views: 1836

Answers (2)

Thomas Besnehard
Thomas Besnehard

Reputation: 2095

The solution was to do it programmatically :

webView.setBackgroundResource(R.drawable.backgroundImage);

As explain in this question : Set a background image for a webview in Android

Upvotes: 1

Joe T
Joe T

Reputation: 2350

try putting the file name in quotes

background-image:url('bg_header_sample.png');

Upvotes: 0

Related Questions