简体   繁体   English

在Android中使用webview显示html格式表

[英]Display html formated table using webview in Android

I am trying a lot but it is not wroking. 我正在尝试很多,但它不是在徘徊。 Here's my code: 这是我的代码:

public class SchofferStr extends Activity {

    String summary = "<html><body>You scored <b>192</b> points.</body></html>";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.menu);
        WebView webview = new WebView(this);
        setContentView(webview);
        webview.loadData(summary, "text/html", "utf-8");
    }

}

the summary string i have is a lengthy htmlformatted table. 我有的摘要字符串是一个冗长的html格式表。 But problem is this code is not even working for this simple html formated string. 但问题是这个代码甚至不适用于这个简单的html格式化字符串。 What is it that im doing wrong? 我做错了什么? Please help, im stuck. 请帮助,我卡住了。

尝试:

webview.loadDataWithBaseURL(null, summary, "text/html", "UTF-8", null);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM