直接把HTML code在一个web视图(安卓) [英] Directly put html code in a WebView (Android)

查看:111
本文介绍了直接把HTML code在一个web视图(安卓)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用的WebView,我们通常把一个网址吧:

While using WebView, we usually put a URL for it:

WebView.loadUrl(myURL);

,但它是可以直接将HTML code 12因此,这将是在一个逻辑:

but it is possible to put HTML code directly?? So that it will be in a logic that:

WebView.loadContent ( <html><head><script></script></head><body>....</body></html> );

感谢。

推荐答案

看看这个: <一href="http://developer.android.com/reference/android/webkit/WebView.html">http://developer.android.com/reference/android/webkit/WebView.html

 // OR, you can also load from an HTML string:
 String summary = "<html><body>You scored <b>192</b> points.</body></html>";
 webview.loadData(summary, "text/html", null);

这篇关于直接把HTML code在一个web视图(安卓)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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