本文整理汇总了Java中com.tencent.smtt.sdk.WebSettings.setBuiltInZoomControls方法的典型用法代码示例。如果您正苦于以下问题:Java WebSettings.setBuiltInZoomControls方法的具体用法?Java WebSettings.setBuiltInZoomControls怎么用?Java WebSettings.setBuiltInZoomControls使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.tencent.smtt.sdk.WebSettings
的用法示例。
在下文中一共展示了WebSettings.setBuiltInZoomControls方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initWebViewSettings
import com.tencent.smtt.sdk.WebSettings; //导入方法依赖的package包/类
private void initWebViewSettings() {
WebSettings webSetting = this.getSettings();
webSetting.setJavaScriptEnabled(true);
webSetting.setJavaScriptCanOpenWindowsAutomatically(true);
webSetting.setAllowFileAccess(true);
webSetting.setLayoutAlgorithm(LayoutAlgorithm.NARROW_COLUMNS);
webSetting.setSupportZoom(true);
webSetting.setBuiltInZoomControls(true);
webSetting.setUseWideViewPort(true);
webSetting.setSupportMultipleWindows(true);
// webSetting.setLoadWithOverviewMode(true);
webSetting.setAppCacheEnabled(true);
// webSetting.setDatabaseEnabled(true);
webSetting.setDomStorageEnabled(true);
webSetting.setGeolocationEnabled(true);
webSetting.setAppCacheMaxSize(Long.MAX_VALUE);
// webSetting.setPageCacheCapacity(IX5WebSettings.DEFAULT_CACHE_CAPACITY);
webSetting.setPluginState(WebSettings.PluginState.ON_DEMAND);
// webSetting.setRenderPriority(WebSettings.RenderPriority.HIGH);
webSetting.setCacheMode(WebSettings.LOAD_NO_CACHE);
}
示例2: initWebViewSetting
import com.tencent.smtt.sdk.WebSettings; //导入方法依赖的package包/类
/**
* 初始化WebView的setting事件
*/
private void initWebViewSetting() {
WebSettings webSetting = mWebView.getSettings();
webSetting.setAllowFileAccess(true);
webSetting.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS);
webSetting.setSupportZoom(true);
webSetting.setBuiltInZoomControls(true);
webSetting.setUseWideViewPort(true);
webSetting.setSupportMultipleWindows(false);
// webSetting.setLoadWithOverviewMode(true);
webSetting.setAppCacheEnabled(true);
// webSetting.setDatabaseEnabled(true);
webSetting.setDomStorageEnabled(true);
webSetting.setJavaScriptEnabled(true);
webSetting.setGeolocationEnabled(true);
webSetting.setAppCacheMaxSize(Long.MAX_VALUE);
webSetting.setAppCachePath(this.getDir("appcache", 0).getPath());
webSetting.setDatabasePath(this.getDir("databases", 0).getPath());
webSetting.setGeolocationDatabasePath(this.getDir("geolocation", 0)
.getPath());
// webSetting.setPageCacheCapacity(IX5WebSettings.DEFAULT_CACHE_CAPACITY);
webSetting.setPluginState(WebSettings.PluginState.ON_DEMAND);
CookieSyncManager.createInstance(this);
CookieSyncManager.getInstance().sync();
}
示例3: initWebViewSettings
import com.tencent.smtt.sdk.WebSettings; //导入方法依赖的package包/类
private void initWebViewSettings() {
WebSettings webSetting = this.getSettings();
webSetting.setJavaScriptEnabled(true);
webSetting.setJavaScriptCanOpenWindowsAutomatically(true);
webSetting.setAllowFileAccess(true);
webSetting.setLayoutAlgorithm(LayoutAlgorithm.NARROW_COLUMNS);
webSetting.setSupportZoom(true);
webSetting.setBuiltInZoomControls(true);
webSetting.setUseWideViewPort(true);
webSetting.setSupportMultipleWindows(true);
webSetting.setAppCacheEnabled(true);
webSetting.setDomStorageEnabled(true);
webSetting.setGeolocationEnabled(true);
webSetting.setAppCacheMaxSize(Long.MAX_VALUE);
webSetting.setPluginState(WebSettings.PluginState.ON_DEMAND);
webSetting.setCacheMode(WebSettings.LOAD_NO_CACHE);
}
示例4: initWebViewSetting
import com.tencent.smtt.sdk.WebSettings; //导入方法依赖的package包/类
/**
* init WebView
*/
private void initWebViewSetting() {
WebSettings webSetting = mWebView.getSettings();
webSetting.setAllowFileAccess(true);
webSetting.setLayoutAlgorithm(LayoutAlgorithm.NARROW_COLUMNS);
webSetting.setSupportZoom(true);
webSetting.setBuiltInZoomControls(true);
webSetting.setUseWideViewPort(true);
webSetting.setSupportMultipleWindows(false);
webSetting.setAppCacheEnabled(true);
webSetting.setDomStorageEnabled(true);
webSetting.setJavaScriptEnabled(true);
webSetting.setGeolocationEnabled(true);
webSetting.setAppCacheMaxSize(Long.MAX_VALUE);
webSetting.setAppCachePath(this.getDir("appcache", 0).getPath());
webSetting.setDatabasePath(this.getDir("databases", 0).getPath());
webSetting.setGeolocationDatabasePath(this.getDir("geolocation", 0)
.getPath());
webSetting.setPluginState(WebSettings.PluginState.ON_DEMAND);
long time = System.currentTimeMillis();
if (mIntentUrl == null) {
mWebView.loadUrl(mHomeUrl);
} else {
mWebView.loadUrl(mIntentUrl.toString());
}
// print the time of webView load
TbsLog.d("time-cost", "cost time: " + (System.currentTimeMillis() - time));
// manage Cookie
CookieSyncManager.createInstance(this);
CookieSyncManager.getInstance().sync();
}
示例5: getWebviewAdaption
import com.tencent.smtt.sdk.WebSettings; //导入方法依赖的package包/类
public void getWebviewAdaption(WebView webView)
{
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
webSettings.setUseWideViewPort(true);//关键点
//启用地理定位
webSettings.setDomStorageEnabled(true);
webSettings.setDatabaseEnabled((Boolean) SPUtils.get(context, "if_4", true));//数据库
webSettings.setGeolocationEnabled((Boolean) SPUtils.get(context, "if_2", true));//地理
webSettings.setUserAgentString("" + SPUtils.get(context, "if_7", "Mozilla/5.0 (iPhone; U; CPU iPhone OS 5_1_1 like Mac OS X; en-us) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9B206 Safari/7534.48.3 XiaoMi/MiuiBrowser/8.9.4"));//UA
webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
webSettings.setDisplayZoomControls(false);
webSettings.setLoadsImagesAutomatically((Boolean) SPUtils.get(context, "if_5", true));//图片
webSettings.setJavaScriptEnabled((Boolean) SPUtils.get(context, "if_1", true)); // 设置支持javascript脚本
webSettings.setAllowFileAccess(true); // 允许访问文件
webSettings.setBuiltInZoomControls(true); // 设置显示缩放按钮
webSettings.setSupportZoom((Boolean) SPUtils.get(context, "if_3", false)); // 支持缩放
webSettings.setLoadWithOverviewMode(true);
DisplayMetrics metrics = new DisplayMetrics();
//getWindowManager().getDefaultDisplay().getMetrics(metrics);
int mDensity = metrics.densityDpi;
// Log.d("maomao", "densityDpi = " + mDensity);
if (mDensity == 240)
{
webSettings.setDefaultZoom(WebSettings.ZoomDensity.FAR);
}
else if (mDensity == 160)
{
webSettings.setDefaultZoom(WebSettings.ZoomDensity.MEDIUM);
}
else if (mDensity == 120)
{
webSettings.setDefaultZoom(WebSettings.ZoomDensity.CLOSE);
}
else if (mDensity == DisplayMetrics.DENSITY_XHIGH)
{
webSettings.setDefaultZoom(WebSettings.ZoomDensity.FAR);
}
else if (mDensity == DisplayMetrics.DENSITY_TV)
{
webSettings.setDefaultZoom(WebSettings.ZoomDensity.FAR);
}
else
{
webSettings.setDefaultZoom(WebSettings.ZoomDensity.MEDIUM);
}
webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS);
}
示例6: provideWebView
import com.tencent.smtt.sdk.WebSettings; //导入方法依赖的package包/类
@Provides
@ActivityScope
@SuppressLint("SetJavaScriptEnabled")
WebView provideWebView(Activity activity) {
WebView webView = new WebView(activity) {
boolean isTouchTriggered = false;
@Override
protected void onScrollChanged(int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
if (isTouchTriggered) {
mBaseViewWebX5.onScrollChanged(scrollX, scrollY, oldScrollX, oldScrollY);
}
}
@Override
public boolean onInterceptTouchEvent(MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
isTouchTriggered = true;
}
return super.onInterceptTouchEvent(event);
}
};
WebSettings settings = webView.getSettings();
settings.setJavaScriptEnabled(true);
settings.setAllowFileAccess(true);
settings.setDomStorageEnabled(true);
settings.setUseWideViewPort(true);
settings.setLoadWithOverviewMode(true);
settings.setSupportZoom(false);
settings.setBuiltInZoomControls(false);
settings.setDisplayZoomControls(false);
String userAgent = JoyWeb.getUserAgent();
if (TextUtil.isNotEmpty(userAgent)) {
settings.setUserAgentString(settings.getUserAgentString() + " " + userAgent);
}
settings.setAppCacheEnabled(JoyWeb.isAppCacheEnabled());
settings.setAppCachePath(JoyWeb.getAppCachePath());
settings.setAppCacheMaxSize(JoyWeb.getAppCacheMaxSize());
if (mCacheEnable) {
boolean networkEnable = DeviceUtil.isNetworkEnable(activity.getApplicationContext());
settings.setCacheMode(networkEnable ? WebSettings.LOAD_NO_CACHE : WebSettings.LOAD_CACHE_ONLY);
} else {
settings.setCacheMode(WebSettings.LOAD_NO_CACHE);
}
return webView;
}