Java Code Examples for android.webkit.WebView#getHeight()
The following examples show how to use
android.webkit.WebView#getHeight() .
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: NestedTouchScrollingLayout.java From NestedTouchScrollingLayout with MIT License | 5 votes |
/** * 规避 contentHeight 异步变化 * @return */ private boolean canWebViewScrollUp(WebView webView) { if (mWebViewContentHeight == 0) { mWebViewContentHeight = (int) (webView.getContentHeight() * webView.getScale()); } final int offset = webView.getScrollY(); final int range = mWebViewContentHeight - webView.getHeight(); if (range == 0) { return false; } return offset > 2; }
Example 2
Source File: NestedTouchScrollingLayout.java From NestedTouchScrollingLayout with MIT License | 5 votes |
/** * 规避 contentHeight 异步变化 * @return */ private boolean canWebViewScrollDown(WebView webView) { if (mWebViewContentHeight == 0) { mWebViewContentHeight = (int) (webView.getContentHeight() * webView.getScale()); } final int offset = webView.getScrollY(); final int range = mWebViewContentHeight - webView.getHeight(); if (range == 0) { return false; } return offset < range - 2; }
Example 3
Source File: WebUtils.java From AndroidRipper with GNU Affero General Public License v3.0 | 5 votes |
/** * Returns true if the view is sufficiently shown * * @param view the view to check * @return true if the view is sufficiently shown */ public final boolean isWebElementSufficientlyShown(WebElement webElement){ final WebView webView = viewFetcher.getFreshestView(viewFetcher.getCurrentViews(WebView.class, true)); final int[] xyWebView = new int[2]; if(webView != null && webElement != null){ webView.getLocationOnScreen(xyWebView); if(xyWebView[1] + webView.getHeight() > webElement.getLocationY()) return true; } return false; }
Example 4
Source File: WebViewText.java From android-app with GNU General Public License v3.0 | 5 votes |
private float convertWebViewToScreenY(float y) { if (ttsHost == null) { Log.w(TAG, "convertWebViewToScreenY() ttsHost is null"); return 0; } WebView webView = ttsHost.getWebView(); return y * webView.getHeight() / webView.getContentHeight(); }
Example 5
Source File: ScrollingUtil.java From AgentWebX5 with Apache License 2.0 | 4 votes |
public static boolean isWebViewToBottom(WebView webview, int mTouchSlop) { return webview != null && ((webview.getContentHeight() * webview.getScale() - (webview.getHeight() + webview.getScrollY())) <= 2 * mTouchSlop); }
Example 6
Source File: ScrollingUtil.java From TwinklingRefreshLayout with Apache License 2.0 | 4 votes |
public static boolean isWebViewToBottom(WebView webview, int mTouchSlop) { return webview != null && ((webview.getContentHeight() * webview.getScale() - (webview.getHeight() + webview.getScrollY())) <= 2 * mTouchSlop); }