com.tencent.smtt.sdk.WebView.getContentHeight()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(1.9k)|赞(0)|评价(0)|浏览(197)

本文整理了Java中com.tencent.smtt.sdk.WebView.getContentHeight()方法的一些代码示例,展示了WebView.getContentHeight()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebView.getContentHeight()方法的具体详情如下:
包路径:com.tencent.smtt.sdk.WebView
类名称:WebView
方法名:getContentHeight

WebView.getContentHeight介绍

暂无

代码示例

代码示例来源:origin: Justson/AgentWebX5

public static boolean isX5WebViewToBottom(com.tencent.smtt.sdk.WebView webview, int mTouchSlop) {
  LogUtil.i("webview.getContentHeight() :"+webview.getContentHeight() +"  getScale:"+webview.getScale()+"  getHeight:"+webview.getHeight()+"  webview.getScrollY:"+ webview.getScrollY()+"   mTouchSlop:"+mTouchSlop+"   (webview.getContentHeight() * webview.getScale() - (webview.getHeight() + webview.getScrollY())):"+(webview.getContentHeight() * webview.getScale() - (webview.getHeight() + webview.getScrollY()))+"   2 * mTouchSlop:"+(2 * mTouchSlop)+"   getY:"+webview.getY()+"  getWebScrollY:"+webview.getWebScrollY()+"   getPivotY :"+webview.getPivotY()+"    getTranslationY:"+webview.getTranslationY());
  return webview != null && ((webview.getContentHeight() * webview.getScale() - (webview.getHeight() + webview.getWebScrollY())) <= 2 * mTouchSlop);
}

代码示例来源:origin: linxin6560/DetailScrollView

@Override
  public boolean onPreDraw() {
    WebView webView = (WebView) mWebView;
    webView.getGlobalVisibleRect(outRect);
    int distBottom = DetailScrollView.this.getHeight() - outRect.height();
    if (distBottom <= 0
        || DetailScrollView.this.getScrollY() == 0//没触发滑动的时候不扩展
        || webView.getHeight() < DetailScrollView.this.getHeight())//webView本身高度就小于scrollview,也不扩展
      return true;
    int newWebViewContentHeight = webView.getContentHeight();
    if (mOldWebViewContentHeight == newWebViewContentHeight)
      return true;
    mOldWebViewContentHeight = newWebViewContentHeight;
    ViewGroup.LayoutParams lp = webView.getLayoutParams();
    lp.height = webView.getMeasuredHeight() + distBottom;
    webView.setLayoutParams(lp);
    return true;
  }
});

相关文章