WebView使用以及JS交互以及浏览器编写

webView基本使用:

WebView在当前的App中加载网页

WebView加载网页显示实时进度
webView浏览器的使用
JS交互:   WebView与Js交互的实现
新闻客户端模块编写

public class MainActivity extends AppCompatActivity {
    private WebView web;
    ProgressDialog progressDialog;
    String url="\n" +
            "\n" +
            "\t\n" +
            "\t\t\n" +
            "\t\t\n" +
            "\t\n" +
            "\t

asdasd

\n" + "\t

你好

\n" + "\t\n" + "\t\n" + ""; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); web = (WebView) findViewById(R.id.web); // web.loadUrl("http://wallpaperswide.com/"); //加载自己写的text网页 // web.loadData(url,"text/html",null); //汉字编码 //web.loadDataWithBaseURL(null ,url,"text/html","utf_8",null); web.loadUrl("file:///android_asset/test.html"); //加载网站必写的 web.setWebViewClient(new WebViewClient()); //进度条加对话框 progressDialog=new ProgressDialog(this); progressDialog.setMessage("进度对话框"); progressDialog.setTitle("对话框"); progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); progressDialog.setButton("确定", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { progressDialog.dismiss(); } }); // progressDialog.show(); web.setWebViewClient(new WebViewClient(){ @Override public void onPageStarted(WebView view, String url, Bitmap favicon) { super.onPageStarted(view, url, favicon); progressDialog.show(); } @Override public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); progressDialog.dismiss(); } }); }

                布局 



    

你可能感兴趣的:(javascript,交互,前端)