activity代码如下:
package com.example.reg; import android.app.Activity;import android.os.Bundle;import android.util.Log;import android.webkit.WebView; public class WebViewActivity extends Activity{ private static final String tag = WebViewActivity.class.getSimpleName(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.webview); WebView webview = (WebView) findViewById(R.id.web_view); webview.getSettings().setJavaScriptEnabled(true); //webview.loadUrl("http://www.baidu.com"); //用file://来指定本地文件 webview.loadUrl("file:///android_asset/html/test.html"); Log.d(tag, "执行结束.."); } }html页面路径:
\reg\assets\index.html \reg 为项目名称
HTML代码如下:
立即学习“前端免费学习笔记(深入)”;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html><head> <title>Hello First Html..</title> </head><body> First Html</body></html>
HTML怎么学习?HTML怎么入门?HTML在哪学?HTML怎么学才快?不用担心,这里为大家提供了HTML速学教程(入门课程),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号