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

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

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

WebView.getMeasuredHeight介绍

暂无

代码示例

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

View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
webView.layout(0, 0, webView.getMeasuredWidth(),
    webView.getMeasuredHeight());
webView.setDrawingCacheEnabled(true);
webView.buildDrawingCache();
Bitmap bitmap = Bitmap.createBitmap(webView.getMeasuredWidth(),
    webView.getMeasuredHeight(), Bitmap.Config.ARGB_8888);

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

MeasureSpec.makeMeasureSpec((p.x < p.y ? p.x : p.y),
          MeasureSpec.EXACTLY));
webView.layout(0, 0, webView.getMeasuredWidth(), webView.getMeasuredHeight());

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

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

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

MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
webView.layout(0, 0, webView.getMeasuredWidth(),
    webView.getMeasuredHeight());
webView.setDrawingCacheEnabled(true);
webView.buildDrawingCache();
Bitmap bm = Bitmap.createBitmap(webView.getMeasuredWidth(),
    webView.getMeasuredHeight(), Bitmap.Config.ARGB_8888);

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

public static Bitmap screenshot2(WebView webView) {
  webView.measure(MeasureSpec.makeMeasureSpec(
          MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED),
      MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
  webView.layout(0, 0, webView.getMeasuredWidth(), webView.getMeasuredHeight());
  webView.setDrawingCacheEnabled(true);
  webView.buildDrawingCache();
  Bitmap bitmap = Bitmap.createBitmap(webView.getMeasuredWidth(),
      webView.getMeasuredHeight(), Bitmap.Config.ARGB_8888);

  Canvas canvas = new Canvas(bitmap);
  Paint paint = new Paint();
  int iHeight = bitmap.getHeight();
  canvas.drawBitmap(bitmap, 0, iHeight, paint);
  webView.draw(canvas);
  return bitmap;
}

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

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

代码示例来源:origin: LonamiWebs/Stringlate

/**
 * Create a picture out of {@link WebView}'s whole content
 *
 * @param webView The WebView to get contents from
 * @return A {@link Bitmap} or null
 */
@Nullable
public static Bitmap getBitmapFromWebView(WebView webView) {
  try {
    //Measure WebView's content
    int widthMeasureSpec = View.MeasureSpec.makeMeasureSpec(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
    int heightMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
    webView.measure(widthMeasureSpec, heightMeasureSpec);
    webView.layout(0, 0, webView.getMeasuredWidth(), webView.getMeasuredHeight());
    //Build drawing cache and store its size
    webView.buildDrawingCache();
    int measuredWidth = webView.getMeasuredWidth();
    int measuredHeight = webView.getMeasuredHeight();
    //Creates the bitmap and draw WebView's content on in
    Bitmap bitmap = Bitmap.createBitmap(measuredWidth, measuredHeight, Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(bitmap);
    canvas.drawBitmap(bitmap, 0, bitmap.getHeight(), new Paint());
    webView.draw(canvas);
    webView.destroyDrawingCache();
    return bitmap;
  } catch (Exception | OutOfMemoryError e) {
    e.printStackTrace();
    return null;
  }
}

代码示例来源:origin: vihuela/RAD

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

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

+ (myWebView.getMeasuredHeight() / mContext.getResources().getDisplayMetrics().density)
+ "px; -webkit-column-gap: 0px; -webkit-column-width: "
+ myWebView.getMeasuredWidth() + "px;')";

代码示例来源: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);
    }
  }
}

代码示例来源:origin: fengmaolian/AnalyzeRecyclerViewWithBGARefreshLayout

if (mWebView.getContentHeight() * mWebView.getScale() == (mWebView.getScrollY() + mWebView.getMeasuredHeight())) {
  return true;

相关文章

微信公众号

最新文章

更多

WebView类方法