Aero13
Aero13

Reputation: 21

How to reference / link to a Css-File styling elements in a webview for Android

I have several Xsl-Files, which extract Informations from an Xml-File for a Android App. The Xml-File is also used for a mobile website, so it has html-tags included.

The output of the text is placed in a webview, now i want to style the html Elements with Css-Stylesheets, which are located in my local Css-File.

My question is, where can i reference to my Css-File?

I tried to include it in the xsl-Files, but that wasn't sucessful:

    <xsl:template match="/">
    <html>
         <head>
         <link rel="stylesheet" type="text/css" href="file:///android_asset/raw/design.css" />       
         </head>
    .....

The following method works fine, but at any changes i must update all the xsl-Files.

    <style type="text/css">
           Css-Stylesheets here
    </style>

Is there an better, easier or smarter way to reference / link to the Css-File?

Thanks for your help, Aero13 (with his bad school english ; ))

Upvotes: 1

Views: 1368

Answers (1)

Aero13
Aero13

Reputation: 21

I have solved the problem. A very simple Problem : /

The problem was the wrong folder i searched in.

href="file:///android_asset/raw/design.css"
and 
href="file:///android_res/raw/design.css"

The file was located in res, not in assets.

Upvotes: 1

Related Questions