当前位置: 首页>>代码示例>>Java>>正文


Java WebView.setWebViewClient方法代码示例

本文整理汇总了Java中android.webkit.WebView.setWebViewClient方法的典型用法代码示例。如果您正苦于以下问题:Java WebView.setWebViewClient方法的具体用法?Java WebView.setWebViewClient怎么用?Java WebView.setWebViewClient使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.webkit.WebView的用法示例。


在下文中一共展示了WebView.setWebViewClient方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: decodePath

import android.webkit.WebView; //导入方法依赖的package包/类
public void decodePath(String srcUrl) {
    WebView webView = new WebView(Utils.getContext());

    WebSettings settings = webView.getSettings();
    settings.setJavaScriptEnabled(true);//设置JS可用
    settings.setCacheMode(WebSettings.LOAD_NO_CACHE);

    ParseRelation relation = new ParseRelation(new IGetParamsListener() {
        @Override
        public void onGetParams(String r, String s) {
            sendRequest(srcUrl, r, s);
        }
    });

    webView.addJavascriptInterface(relation, NICK);//绑定JS和Java的联系类,以及使用到的昵称

    webView.loadUrl("file:///android_asset/parse.html");
    webView.setWebViewClient(new WebViewClient() {
        @Override
        public void onPageFinished(WebView view, String url) {
            webView.loadUrl("javascript:getParseParam('" + srcUrl + "')");
        }
    });
}
 
开发者ID:Wilshion,项目名称:HeadlineNews,代码行数:25,代码来源:VideoPathDecoder.java

示例2: onCreate

import android.webkit.WebView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_function_introduced);
    setTitle(R.string.function_introduce);

    mWebView = (WebView) findViewById(R.id.function_introdiced_webview);
    mWebView.getSettings().setJavaScriptEnabled(true);
    mWebView.getSettings().setUseWideViewPort(true);
    mWebView.getSettings().setLoadWithOverviewMode(true);
    mWebView.getSettings().setBuiltInZoomControls(true);
    mWebView.getSettings().setSupportZoom(true);


    MyWebViewClient mMyWebViewClient = new MyWebViewClient();
    mMyWebViewClient.onPageFinished(mWebView, "http://rongcloud.cn/features");
    mMyWebViewClient.shouldOverrideUrlLoading(mWebView, "http://rongcloud.cn/features");
    mMyWebViewClient.onPageFinished(mWebView, "http://rongcloud.cn/features");
    mWebView.setWebViewClient(mMyWebViewClient);
}
 
开发者ID:LanguidSheep,项目名称:sealtalk-android-master,代码行数:21,代码来源:FunctionIntroducedActivity.java

示例3: initWidgets

import android.webkit.WebView; //导入方法依赖的package包/类
@Override
protected void initWidgets() {
    super.initWidgets();
    mBackImg = (ImageView) findViewById(R.id.kf5_return_img);
    mBackImg.setOnClickListener(this);
    mWebView = (WebView) findViewById(R.id.kf5_post_detail_content);
    mDetailTitle = (TextView) findViewById(R.id.kf5_post_detail_title);
    mDate = (TextView) findViewById(R.id.kf5_post_detail_date);
    WebSettings webSettings = mWebView.getSettings();
    webSettings.setBuiltInZoomControls(false);
    webSettings.setDomStorageEnabled(true);
    webSettings.setDatabaseEnabled(true);
    webSettings.setAppCacheEnabled(true);
    webSettings.setLoadsImagesAutomatically(true);
    webSettings.setPluginState(WebSettings.PluginState.ON);
    webSettings.setBuiltInZoomControls(false); //显示放大缩小 controler
    webSettings.setSupportZoom(false); //可以缩放
    webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
    mWebView.setWebViewClient(new MyWebViewClient());
}
 
开发者ID:Zyj163,项目名称:yyox,代码行数:21,代码来源:HelpCenterTypeDetailsActivity.java

示例4: optionChangelog

import android.webkit.WebView; //导入方法依赖的package包/类
private void optionChangelog() {
	WebView webview = new WebView(this);
	webview.setWebViewClient(new WebViewClient() {
		public void onPageFinished(WebView view, String url) {
			int userId = Util.getUserId(Process.myUid());
			Version currentVersion = new Version(Util.getSelfVersionName(ActivityMain.this));
			PrivacyManager.setSetting(userId, PrivacyManager.cSettingChangelog, currentVersion.toString());
		}
	});
	webview.loadUrl("https://github.com/M66B/XPrivacy/blob/master/CHANGELOG.md");

	AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
	alertDialogBuilder.setTitle(R.string.menu_changelog);
	alertDialogBuilder.setIcon(getThemed(R.attr.icon_launcher));
	alertDialogBuilder.setView(webview);
	AlertDialog alertDialog = alertDialogBuilder.create();
	alertDialog.show();
}
 
开发者ID:ukanth,项目名称:XPrivacy,代码行数:19,代码来源:ActivityMain.java

示例5: onCreate

import android.webkit.WebView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_reg);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    actionBar=getSupportActionBar();
    actionBar.setTitle("Register");

    Bundle bundle=this.getIntent().getExtras();
    url=bundle.getString("url");
    webView = (WebView)findViewById(R.id.webView);
    webView.getSettings().setJavaScriptEnabled(true);
    webView.setWebViewClient(new WebViewClient());
    webView.loadUrl(url);

}
 
开发者ID:vikasdesale,项目名称:Wings2K16,代码行数:18,代码来源:RegisterActivity.java

示例6: onCreateView

import android.webkit.WebView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
    View view=inflater.inflate(R.layout.fragment_browser, container, false);
    editText=(EditText)view.findViewById(R.id.url);
    webView=(WebView)view.findViewById(R.id.webview);
    load=(Button)view.findViewById(R.id.buton);
    load.setOnClickListener(this);
    Web web=new Web();
    webView.setWebViewClient(web);
    editText.setText("https://www.google.com");
    webView.loadUrl("https://www.google.com");
    
    return view;

}
 
开发者ID:akashdeepsingh9988,项目名称:Cybernet-VPN,代码行数:17,代码来源:BowserFragment.java

示例7: onCreate

import android.webkit.WebView; //导入方法依赖的package包/类
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_load_url);
        webview = (WebView) findViewById(R.id.webview);
        webview.loadUrl("https://www.sawerly.com/beta/cms/3/en");
        webview.getSettings().setUseWideViewPort(true);
        webview.getSettings().setJavaScriptEnabled(true);
//        webview.measure(100,100);
        webview.setWebViewClient(new WebViewClient(){
            @Override
            public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
                super.onReceivedSslError(view, handler, error);
                handler.proceed();
            }
        });
//        webview.setWebChromeClient(new WebChromeClient());
    }
 
开发者ID:parthdave93,项目名称:AndroidTestingTutorial,代码行数:19,代码来源:LoadUrl.java

示例8: init

import android.webkit.WebView; //导入方法依赖的package包/类
private void init() {
    mWebView = (WebView) findViewById(R.id.news_webview);
    mWebView.getSettings().setJavaScriptEnabled(true);
    mWebView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
    mWebView.setWebViewClient(new WebViewClient());
    mWebView.setWebChromeClient(new WebChromeClient(){
        @Override
        public void onProgressChanged(WebView view, int newProgress) {
            if (newProgress == 100) {
                closeDialog();
            } else {
                openLoadingDialog(newProgress);
            }
        }
    });

}
 
开发者ID:AndroidWJC,项目名称:UnversityFinance,代码行数:18,代码来源:WebViewActivity.java

示例9: onCreate

import android.webkit.WebView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);

    setContentView(R.layout.activity_webview);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
    }

    WebView webView = (WebView) findViewById(R.id.webview);
    webView.setWebViewClient(new BrowserClient());
    webView.getSettings().setLoadsImagesAutomatically(true);
    webView.getSettings().setJavaScriptEnabled(false);
    webView.loadUrl(APIConstants.SONO_ROOT);
}
 
开发者ID:Snooze986,项目名称:SonoESEO-Android,代码行数:18,代码来源:WebviewActivity.java

示例10: onCreate

import android.webkit.WebView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_about);

    getSupportActionBar().setTitle(getString(R.string.about));
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    progressBar = (ProgressBar) findViewById(R.id.progress);
    progressBar.getIndeterminateDrawable()
            .setColorFilter(ContextCompat.getColor(this, R.color.colorPrimary), PorterDuff.Mode.SRC_IN);
    info_web = (WebView) findViewById(R.id.webview_company_info);
    info_web.setBackgroundColor(Color.TRANSPARENT);
    info_web.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    info_web.setWebViewClient(new myWebClient());
    info_web.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
    info_web.getSettings().setJavaScriptEnabled(true);
    String infoText = getString(R.string.company_info_web);
    info_web.loadDataWithBaseURL("file:///android_asset/fonts/", getWebViewText(infoText), "text/html", "utf-8", null);

}
 
开发者ID:fekracomputers,项目名称:QuranAndroid,代码行数:22,代码来源:AboutActivity.java

示例11: onCreate

import android.webkit.WebView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_web);
    Intent iGet = getIntent();
    String org_web = iGet.getStringExtra("org_web");
    WebView webb = (WebView)findViewById(R.id.web);
    webb.setWebViewClient(new WebViewClient());
    webb.loadUrl(org_web);
}
 
开发者ID:doljko,项目名称:youth-health,代码行数:11,代码来源:WebActivity.java

示例12: onCreate

import android.webkit.WebView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState)
{
	super.onCreate(savedInstanceState);
	mWebView = new WebView(this);
	mWebView.getSettings().setJavaScriptEnabled(true);
	mWebView.setWebViewClient(new WebViewClient());
	mWebView.addJavascriptInterface(this, "Android");
	mWebView.loadUrl("file:///android_asset/index.html");
	setContentView(mWebView);
}
 
开发者ID:sdrausty,项目名称:buildAPKsApps,代码行数:12,代码来源:MainActivity.java

示例13: onCreate

import android.webkit.WebView; //导入方法依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Window window = getWindow();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        window.setStatusBarColor(ContextCompat.getColor(this, R.color.colorPrimaryDark));
    }
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    mWebView = new WebView(this);
    mWebView.setScrollContainer(false);
    ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT);
    setContentView(mWebView, layoutParams);

    Bundle args = getIntent().getExtras();
    String url = args.getString(ARG_URL);

    mWebView.setWebViewClient(new WebViewClient());
    mWebView.getSettings().setJavaScriptEnabled(true);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        mWebView.getSettings().setMediaPlaybackRequiresUserGesture(false);
    }
    mWebView.setWebChromeClient(new WebChromeClient());
    mWebView.loadUrl(url);
}
 
开发者ID:qqq3,项目名称:inventum,代码行数:28,代码来源:VideoActivity.java

示例14: onCreateView

import android.webkit.WebView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    view= inflater.inflate(R.layout.fragment_knowyour30_webview, container, false);
    web=(WebView)view.findViewById(R.id.web_View);
    WebSettings webs =web.getSettings();
    webs.setJavaScriptEnabled(true);
    web.loadUrl(myUrl);
    web.setWebViewClient(new myWebViewClient());
    return view;
}
 
开发者ID:IOSD,项目名称:YFHR_Android_App,代码行数:13,代码来源:Knowyour30_webview.java

示例15: onCreate

import android.webkit.WebView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    String html = this.getIntent().getStringExtra("html");
    lessonName = this.getIntent().getStringExtra("lesson_name");
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setDisplayShowHomeEnabled(true);
    getSupportActionBar().setTitle(lessonName);

    toolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            finish();
        }
    });

    ViewStub stub = (ViewStub) findViewById(R.id.layout_stub);
    stub.setLayoutResource(R.layout.activity_web_view);
    View inflated = stub.inflate();

    String mime = "text/html";
    String encoding = "utf-8";

    final WebView myWebView = (WebView) findViewById(R.id.webViewArcticle);

    myWebView.getSettings().setJavaScriptEnabled(true);
    myWebView.setWebViewClient(webViewClient);
    myWebView.loadDataWithBaseURL(null, html, mime, encoding, null);
}
 
开发者ID:white-collar,项目名称:mobile-grammar,代码行数:34,代码来源:WebViewActivity.java


注:本文中的android.webkit.WebView.setWebViewClient方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。