android.webkit.WebView.getContentHeight()方法的使用及代码示例

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

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

WebView.getContentHeight介绍

暂无

代码示例

代码示例来源:origin: square/assertj-android

public WebViewAssert hasContentHeight(int height) {
 isNotNull();
 int actualHeight = actual.getContentHeight();
 assertThat(actualHeight) //
   .overridingErrorMessage("Expected content height <%s> but was <%s>.", height,
     actualHeight) //
   .isEqualTo(height);
 return this;
}

代码示例来源:origin: jberkel/sms-backup-plus

@Override @SuppressWarnings("deprecation") public void onPageFinished(WebView view, String url) {
    super.onPageFinished(view, url);
    if (scrollPosition > 0 &&
      ABOUT_HTML.equals(url) &&
      Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
      view.setScrollY((int) (view.getContentHeight() * view.getScale() * scrollPosition));
    }
  }
});

代码示例来源:origin: jberkel/sms-backup-plus

@Override @SuppressWarnings("deprecation")
  public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    final float position = webView.getScrollY() / (webView.getContentHeight() * webView.getScale());
    outState.putFloat(SCROLL_POSITION, position);
  }
}

代码示例来源:origin: tianshaojie/AndroidFine

@Override
protected boolean isReadyForPullEnd() {
  double exactContentHeight = Math.floor(mRefreshableView.getContentHeight() * mRefreshableView.getScale());
  return mRefreshableView.getScrollY() >= (exactContentHeight - mRefreshableView.getHeight());
}

代码示例来源:origin: tianshaojie/AndroidFine

private int getScrollRange() {
    return (int) Math.max(0, Math.floor(mRefreshableView.getContentHeight() * mRefreshableView.getScale())
        - (getHeight() - getPaddingBottom() - getPaddingTop()));
  }
}

代码示例来源:origin: chaychan/TouTiao

public static boolean isWebViewToBottom(WebView webView) {
  return webView != null && webView.getContentHeight() * webView.getScale() == (webView.getScrollY() + webView.getMeasuredHeight());
}

代码示例来源:origin: huxq17/XRefreshView

public boolean canChildPullUp() {
  if (child instanceof AbsListView) {
    AbsListView absListView = (AbsListView) child;
    return canScrollVertically(child, 1)
        || absListView.getLastVisiblePosition() != mTotalItemCount - 1;
  } else if (child instanceof WebView) {
    WebView webview = (WebView) child;
    if (webview instanceof XWebView) {
      return !((XWebView) webview).isBottom();
    } else {
      float left = webview.getContentHeight() * webview.getScale();
      int right = webview.getHeight() + webview.getScrollY();
      return left != right;
    }
  } else if (child instanceof ScrollView) {
    ScrollView scrollView = (ScrollView) child;
    View childView = scrollView.getChildAt(0);
    if (childView != null) {
      return canScrollVertically(child, 1)
          || scrollView.getScrollY() < childView.getHeight() - scrollView.getHeight();
    }
  } else {
    return canScrollVertically(child, 1);
  }
  return true;
}

代码示例来源:origin: stackoverflow.com

web.setPictureListener(new WebView.PictureListener() {
   public void onNewPicture(WebView view, Picture picture) {
     float temp = (float) view.getHeight();
     height = view.getContentHeight() * a;
   }
 });

代码示例来源:origin: Wan7451/Wan_RecycleViewAdapter

@Override
protected boolean isReadyForPullEnd() {
  float exactContentHeight = (float) Math.floor(mRefreshableView.getContentHeight() * mRefreshableView.getScale());
  return mRefreshableView.getScrollY() >= (exactContentHeight - mRefreshableView.getHeight());
}

代码示例来源:origin: Y-bao/PullRefreshView

@Override
public boolean canOverEnd() {
  if (webView.getScrollY() >= webView.getContentHeight() * webView.getScale() - webView.getMeasuredHeight())
    return true;
  else
    return false;
}

代码示例来源:origin: Uphie/ONE-Unofficial

private int getScrollRange() {
    return (int) Math.max(0, FloatMath.floor(mRefreshableView.getContentHeight() * mRefreshableView.getScale())
        - (getHeight() - getPaddingBottom() - getPaddingTop()));
  }
}

代码示例来源:origin: myxh/CoolShopping

private int getScrollRange() {
    return (int) Math.max(0, FloatMath.floor(mRefreshableView.getContentHeight() * mRefreshableView.getScale())
        - (getHeight() - getPaddingBottom() - getPaddingTop()));
  }
}

代码示例来源:origin: myxh/CoolShopping

@Override
protected boolean isReadyForPullEnd() {
  float exactContentHeight = FloatMath.floor(mRefreshableView.getContentHeight() * mRefreshableView.getScale());
  return mRefreshableView.getScrollY() >= (exactContentHeight - mRefreshableView.getHeight());
}

代码示例来源:origin: kaku2015/WeatherAlarmClock

@Override
protected boolean isReadyForPullEnd() {
  float exactContentHeight = FloatMath.floor(mRefreshableView.getContentHeight() * mRefreshableView.getScale());
  return mRefreshableView.getScrollY() >= (exactContentHeight - mRefreshableView.getHeight());
}

代码示例来源:origin: huangfangyi/FanXin

@Override
protected boolean isReadyForPullEnd() {
  float exactContentHeight = FloatMath.floor(mRefreshableView.getContentHeight() * mRefreshableView.getScale());
  return mRefreshableView.getScrollY() >= (exactContentHeight - mRefreshableView.getHeight());
}

代码示例来源:origin: AndroidHensen/YaNi

@Override
protected boolean isReadyForPullEnd() {
  float exactContentHeight = FloatMath.floor(mRefreshableView.getContentHeight() * mRefreshableView.getScale());
  return mRefreshableView.getScrollY() >= (exactContentHeight - mRefreshableView.getHeight());
}

代码示例来源:origin: Uphie/ONE-Unofficial

@Override
protected boolean isReadyForPullEnd() {
  float exactContentHeight = FloatMath.floor(mRefreshableView.getContentHeight() * mRefreshableView.getScale());
  return mRefreshableView.getScrollY() >= (exactContentHeight - mRefreshableView.getHeight());
}

代码示例来源:origin: shanyao0/SimpleApp

@Override
protected boolean isReadyForPullEnd() {
  float exactContentHeight = FloatMath.floor(mRefreshableView.getContentHeight() * mRefreshableView.getScale());
  return mRefreshableView.getScrollY() >= (exactContentHeight - mRefreshableView.getHeight());
}

代码示例来源:origin: alienjun/AJWaveRefreshForAndroid

@Override
protected boolean isReadyForPullEnd() {
  float exactContentHeight = FloatMath.floor(mRefreshableView.getContentHeight() * mRefreshableView.getScale());
  return mRefreshableView.getScrollY() >= (exactContentHeight - mRefreshableView.getHeight());
}

代码示例来源:origin: Y-bao/PullRefreshView

@Override
  public void scrollAViewBy(int dp) {
    float maxScrollY = webView.getContentHeight() * webView.getScale() - webView.getMeasuredHeight();
    if (webView.getScrollY() + dp >= maxScrollY) {
      webView.scrollTo(0, (int) maxScrollY);
    } else {
      webView.scrollBy(0, dp);
    }
  }
}

相关文章

微信公众号

最新文章

更多

WebView类方法