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

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

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

WebView.getHeight介绍

暂无

代码示例

代码示例来源:origin: RobotiumTech/robotium

/**
 * 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;
}

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

try {
  final Bitmap bmp = Bitmap.createBitmap(webView.getWidth(),
    webView.getHeight(), Bitmap.Config.ARGB_8888);
  final Canvas c = new Canvas(bmp);
  webView.draw(c);

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

mWebView.setWebViewClient(new WebViewClient() {
  public void onPageFinished(WebView view, String url) {

    // Column Count is just the number of 'screens' of text. Add one for partial 'screens'
    int columnCount = Math.floor(view.getHeight() / view.getWidth())+1;

    // Must be expressed as a percentage. If not set then the WebView will not stretch to give the desired effect.
    int columnWidth = columnCount * 100;

    String js = "var d = document.getElementsByTagName('body')[0];" + 
      "d.style.WebkitColumnCount=" + columnCount + ";" + 
      "d.style.WebkitColumnWidth='" + columnWidth + "%';";
    mWebView.loadUrl("javascript:(function(){" + js + "})()");
  }
});

mWebView.loadUrl("file:///android_asset/chapter.xml");

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

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

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

public void _dropText(WebView wv, String text, float x, float y) {
  wv.loadUrl("javascript:dropText('" + text + "', " + x + ", " + y + ", " + wv.getHeight()
      + ", " + wv.getWidth() + ")");
}

代码示例来源: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: wallabag/android-app

private float convertWebViewToScreenY(float y)
{
  return y * this.webView.getHeight() / this.webView.getContentHeight();
}

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

private WebView mWebView;
public void onSavePhoto(int top, int left, int width, int height){
  Bitmap bitmap = Bitmap.createBitmap(mWebView.getWidth(), mWebView.getHeight(), Bitmap.Config.ARGB_8888);
  Canvas canvas = new Canvas(bitmap);
  mWebView.draw(canvas);

  // crop bitmap:
  Bitmap croppedBitmap = Bitmap.createBitmap(bitmap, left, top, width, height);
}

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

class WebViewUtil {

  public static void scaleTo(WebView view, Int size) {
    double currentHeight = view.getHeight();
    double currentWidth = view.getWidth();

    double scaleX = size / currentWidth;
    double scaleY = size / currentHeight;
    double scale = Math.min(scaleX, scaleY);

    view.scaleX(scale); view.scaleY(scale);
  }

}

代码示例来源:origin: open-android/PullToRefresh

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

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

@Override
protected boolean isReadyForPullEnd() {
  float exactContentHeight = (float) Math.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: AndroidHensen/YaNi

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

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

@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: shanyao0/SimpleApp

@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: alienjun/AJWaveRefreshForAndroid

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

代码示例来源:origin: gdpancheng/LoonAndroid3

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

相关文章

微信公众号

最新文章

更多

WebView类方法