码迷,mamicode.com
首页 > Web开发 > 详细

WebView

时间:2016-04-23 16:22:16      阅读:198      评论:0      收藏:0      [点我收藏+]

标签:

package com.example.qjm3662.service_learn;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.ActionMode;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.AbsListView;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class MainActivity extends AppCompatActivity {

    private static final String[] ITEMS = {"Lost","Time","Will","Never","Be","Find","again!"};
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        WebView webView = new WebView(this);
        //启用javascript支持
        webView.getSettings().setJavaScriptEnabled(true);
        //让WebView自己相应url,将新的url显示在当前view
        webView.setWebViewClient(new WebViewClient());
        webView.loadUrl("http://www.cnblogs.com/qjm253/");
        setContentView(webView);
    }

    private WebViewClient mWebViewClient = new WebViewClient(){
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            return super.shouldOverrideUrlLoading(view, url);
        }
    };


}

 

WebView

标签:

原文地址:http://www.cnblogs.com/qjm253/p/5424720.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!