Android中WebView在加载网页的时候,怎样应用本地的CSS效果?就是说怎样把本地的CSS嵌入到HTML中

来源:互联网 发布:农村淘宝代购怎么做 编辑:程序博客网 时间:2024/05/18 14:43
###跟加载本地html一样的。<link rel="stylesheet" href="file:///android_asset/css.css" type="text/css" />##自己的项目中的样子是这个- css文件- .videolist{background:url("../images/playvideo.png") no-repeat;cursor:pointer;padding:5px 25px 5px 25px;margin-left:0px;color:#00a0e9;vertical-align:middle;line-height:26px}- 因为我是项目中直接拼接成一个html然后webview加载直接使用的,所以这里也把拼接的拿出来 String tempUrl= "<html>\n" +                    "<head>\n" +                    "<link rel=\"stylesheet\" type=\"text/css\" href=\"file:///android_asset/music/css/musicexercise.css\" />\n" +                    "</head>\n" +                    "<body>\n" +                    model.getexample() + "\n" +                    "</body>\n" +                    "</html>";- 最后是webview加载这个html webview.loadDataWithBaseURL(null, temp,                            "text/html", "utf-8", null);
0 0