如何引用在Android上的WebView /链接到一个CSS-文件的造型元素 [英] How to reference / link to a Css-File styling elements in a webview for Android

查看:257
本文介绍了如何引用在Android上的WebView /链接到一个CSS-文件的造型元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个XSL-文件,这些文件从XML的文件为Android应用程序中提取信息。
该XML的文件,也可用于移动网站,因此它具有HTML的标记包括在内。

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.

文本的输出被放置在网页视图,现在我想风格的CSS-样式,分别位于我的本地CSS-文件的HTML元素。

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.

我的问题是,我在哪里可以参考我的CSS-文件?

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

我试图把它列入了XSL-文件,但这不是SUCESSFUL:

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>
    .....

下面的方法能正常工作,但任何改变,我必须更新所有的XSL档案。

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

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

有引用/链接到CSS-文件的更好,更容易或更聪明的方式?

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

感谢您的帮助,
Aero13(他学不好英语;))

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

推荐答案

我已经解决了这个问题。一个非常简单的问题:/

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.

这篇关于如何引用在Android上的WebView /链接到一个CSS-文件的造型元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆