Java Code Examples for com.tencent.smtt.sdk.WebView#setInitialScale()
The following examples show how to use
com.tencent.smtt.sdk.WebView#setInitialScale() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultWebClient.java From AgentWebX5 with Apache License 2.0 | 5 votes |
@Override public void onScaleChanged(WebView view, float oldScale, float newScale) { if (AgentWebX5Utils.isOverriedMethod(mWebViewClient, "onScaleChanged", WEBVIEWCLIENTPATH + ".onScaleChanged", WebView.class, float.class, float.class)) { super.onScaleChanged(view, oldScale, newScale); return; } LogUtils.i("Info", "onScaleChanged:" + oldScale + " n:" + newScale); if (newScale - oldScale > CONSTANTS_ABNORMAL_BIG) { view.setInitialScale((int) (oldScale / newScale * 100)); } }
Example 2
Source File: X5WebViewClient.java From YCWebView with Apache License 2.0 | 5 votes |
/** * 当缩放改变的时候会调用该方法 * @param view view * @param oldScale 之前的缩放比例 * @param newScale 现在缩放比例 */ @Override public void onScaleChanged(WebView view, float oldScale, float newScale) { super.onScaleChanged(view, oldScale, newScale); X5LogUtils.i("-------onScaleChanged-------"+newScale); //视频全屏播放按返回页面被放大的问题 if (newScale - oldScale > 7) { //异常放大,缩回去。 view.setInitialScale((int) (oldScale / newScale * 100)); } }