本文整理汇总了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 + "')");
}
});
}
示例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);
}
示例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());
}
示例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();
}
示例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);
}
示例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;
}
示例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());
}
示例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);
}
}
});
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}