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

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

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

WebView.getLocationOnScreen介绍

暂无

代码示例

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

/**
 * Sets the location of a {@code WebElement} 
 * 
 * @param webElement the {@code TextView} object to set location 
 * @param webView the {@code WebView} the text is shown in
 * @param x the x location to set
 * @param y the y location to set
 * @param width the width to set
 * @param height the height to set
 */
private void setLocation(WebElement webElement, WebView webView, int x, int y, int width, int height ){
  float scale = webView.getScale();
  int[] locationOfWebViewXY = new int[2];
  webView.getLocationOnScreen(locationOfWebViewXY);
  int locationX = (int) (locationOfWebViewXY[0] + (x + (Math.floor(width / 2))) * scale);
  int locationY = (int) (locationOfWebViewXY[1] + (y + (Math.floor(height / 2))) * scale);
  webElement.setLocationX(locationX);
  webElement.setLocationY(locationY);
}

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

@Override
public void getLocationOnScreen(int[] location) {
  mWebView.getLocationOnScreen(location);
}

代码示例来源:origin: com.jayway.android.robotium/robotium-solo

/**
 * Sets the location of a {@code WebElement} 
 * 
 * @param webElement the {@code TextView} object to set location 
 * @param webView the {@code WebView} the text is shown in
 * @param x the x location to set
 * @param y the y location to set
 * @param width the width to set
 * @param height the height to set
 */
private void setLocation(WebElement webElement, WebView webView, int x, int y, int width, int height ){
  float scale = webView.getScale();
  int[] locationOfWebViewXY = new int[2];
  webView.getLocationOnScreen(locationOfWebViewXY);
  int locationX = (int) (locationOfWebViewXY[0] + (x + (Math.floor(width / 2))) * scale);
  int locationY = (int) (locationOfWebViewXY[1] + (y + (Math.floor(height / 2))) * scale);
  webElement.setLocationX(locationX);
  webElement.setLocationY(locationY);
}

代码示例来源:origin: com.jayway.android.robotium/robotium-solo

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

相关文章

WebView类方法