本文整理了Java中android.webkit.WebView.requestFocusFromTouch()
方法的一些代码示例,展示了WebView.requestFocusFromTouch()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebView.requestFocusFromTouch()
方法的具体详情如下:
包路径:android.webkit.WebView
类名称:WebView
方法名:requestFocusFromTouch
暂无
代码示例来源:origin: stackoverflow.com
setContentView(R.layout.main);
WebView webview = (WebView) findViewById(R.id.webview);
WebSettings webSettings = webview.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setBuiltInZoomControls(true);
webview.requestFocusFromTouch();
webview.setWebViewClient(new WebViewClient());
webview.setWebChromeClient(new WebChromeClient());
webview.loadUrl("file:///android_asset/test.html");
代码示例来源:origin: hsk256/WebviewCapture
private void initWebview() {
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setSupportZoom(true); //支持缩放
webView.requestFocusFromTouch();
webView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
});
webView.loadUrl("http://www.baidu.com");
}
代码示例来源:origin: hsk256/WebviewCapture
/**
* 设置webview
*/
private void initWebview() {
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setSupportZoom(true); //支持缩放
webView.requestFocusFromTouch();
webView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
});
webView.loadUrl("http://www.baidu.com");
}
代码示例来源:origin: stackoverflow.com
switch (position) {
case 0: {
LayoutInflater mInflater = (LayoutInflater)
context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
layout = mInflater.inflate(R.layout.webprofile, null);
WebView mainContent = (WebView)layout.findViewById(R.id.webview);
mainContent.getSettings().setJavaScriptEnabled(true);
mainContent.getSettings().setJavaScriptEnabled(true);
mainContent.getSettings().setBuiltInZoomControls(true);
mainContent.requestFocusFromTouch();
mainContent.setWebViewClient(new WebViewClient());
mainContent.setWebChromeClient(new WebChromeClient());
mainContent.loadUrl("http://www.wp.pl");
}
break;
代码示例来源:origin: hsk256/WebviewCapture
private void initWebview() {
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setSupportZoom(true); //支持缩放
webView.requestFocusFromTouch();
webView.setDrawingCacheEnabled(true);
webView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
});
webView.loadUrl("http://www.baidu.com");
}
代码示例来源:origin: hsk256/WebviewCapture
private void initWebview() {
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setSupportZoom(true); //支持缩放
webView.requestFocusFromTouch();
webView.setDrawingCacheEnabled(true);
webView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
});
webView.loadUrl("http://www.baidu.com");
}
代码示例来源:origin: BoBoMEe/Android-Demos
public static void basic(WebView webView) {
webView.setFocusable(true);
webView.setFocusableInTouchMode(true);
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
webSettings.setDefaultTextEncodingName("utf-8");
webView.requestFocusFromTouch();
}
}
代码示例来源:origin: Vegen/SmartCampus
@Override
protected void setupUI() {
title = getIntent().getStringExtra("title");
url = getIntent().getStringExtra("url");
// type = getIntent().getIntExtra("type", Constant.MESSAGE_RECRUIT);
setTitle(title);
refreshLayout.setEnableLoadmore(false);
refreshLayout.startRefresh();
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
//设置自适应屏幕,两者合用
webSettings.setUseWideViewPort(true); //将图片调整到适合webview的大小
webSettings.setLoadWithOverviewMode(true); // 缩放至屏幕的大小
// // 强制只加载网页端
// webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE);
// webSettings.setUserAgentString("Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.134 Safari/537.36");
// webSettings.setBuiltInZoomControls(true);
webSettings.setSupportZoom(true);
//支持获取手势焦点
webView.requestFocusFromTouch();
webSettings.setLoadsImagesAutomatically(true); //支持自动加载图片
webSettings.setDefaultTextEncodingName("utf-8");//设置编码格式
webSettings.setDomStorageEnabled(true);
tvNewsTitle.setVisibility(View.GONE);
}
代码示例来源:origin: burgessjp/GanHuoIO
private void initWebViewSettings() {
WebSettings webSettings = mWebView.getSettings();
//支持获取手势焦点,输入用户名、密码或其他
mWebView.requestFocusFromTouch();
webSettings.setJavaScriptEnabled(true); //支持js
//设置自适应屏幕,两者合用
webSettings.setUseWideViewPort(true); //将图片调整到适合webview的大小
webSettings.setLoadWithOverviewMode(true); // 缩放至屏幕的大小
webSettings.setSupportZoom(true); //支持缩放,默认为true。是下面那个的前提。
webSettings.setBuiltInZoomControls(true); //设置内置的缩放控件。
//若上面是false,则该WebView不可缩放,这个不管设置什么都不能缩放。
webSettings.setDisplayZoomControls(false); //隐藏原生的缩放控件
webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN); //支持内容重新布局
webSettings.supportMultipleWindows(); //多窗口
// webSettings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); //关闭webview中缓存
webSettings.setAllowFileAccess(true); //设置可以访问文件
webSettings.setNeedInitialFocus(true); //当webview调用requestFocus时为webview设置节点
webSettings.setJavaScriptCanOpenWindowsAutomatically(true); //支持通过JS打开新窗口
webSettings.setLoadsImagesAutomatically(true); //支持自动加载图片
webSettings.setDefaultTextEncodingName("utf-8");//设置编码格式
}
代码示例来源:origin: ymback/NGA-CLIENT-VER-OPEN-SOURCE
contentTV.setHapticFeedbackEnabled(true);
contentTV.setClickable(true);
contentTV.requestFocusFromTouch();
contentTV.setWebChromeClient(new WebChromeClient() {
代码示例来源:origin: xiaweizi/jsoupJianshuDemo
private void initWebSettings() {
WebSettings settings = mWvShow.getSettings();
mWvShow.requestFocusFromTouch();
代码示例来源:origin: yll2wcf/book
webView.requestFocusFromTouch();
内容来源于网络,如有侵权,请联系作者删除!