Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/194.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android Web视图的HTML字符串_Android_Html_Webview - Fatal编程技术网

Android Web视图的HTML字符串

Android Web视图的HTML字符串,android,html,webview,Android,Html,Webview,我想创建一个android应用程序 apk有一个文本框和一个按钮 在文本框中,用户将输入他们的HTML代码/字符串。 单击该按钮将显示他们从文本框中键入的代码的输出。调用此行: wv.loadData(yourHtmlData, "text/html", "UTF-8"); 你可以这样做 public class MainActivity extends Activity { @Override public void onCreate(Bundle icicle) { sup

我想创建一个android应用程序

apk有一个文本框和一个按钮

在文本框中,用户将输入他们的HTML代码/字符串。 单击该按钮将显示他们从文本框中键入的代码的输出。

调用此行:

wv.loadData(yourHtmlData, "text/html", "UTF-8");

你可以这样做

public class MainActivity extends Activity {
  @Override
  public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.main);

    WebView wv = (WebView) findViewById(R.id.WebView01);        

    final String mimeType = "text/html";
    final String encoding = "UTF-8";
    String html = "<br /><br />Read the handouts please for tomorrow.<br /><br /><!--homework help homework" +
            "help help with homework homework assignments elementary school high school middle school" +
            "// --><font color='#60c000' size='4'><strong>Please!</strong></font>" +
            "<img src='http://www.homeworknow.com/hwnow/upload/images/tn_star300.gif'  />";


    wv.loadDataWithBaseURL("", html, mimeType, encoding, "");
 }

}
将此添加到menifest中

<uses-permission android:name="android.permission.INTERNET"></uses-permission>