本文整理了Java中android.webkit.WebView.getScale()
方法的一些代码示例,展示了WebView.getScale()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebView.getScale()
方法的具体详情如下:
包路径:android.webkit.WebView
类名称:WebView
方法名:getScale
暂无
代码示例来源: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: 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
private class MyWebViewClient extends WebViewClient {
public void onPageFinished(WebView view, String url) {
view.setInitialScale((int)(100*view.getScale()));
}
}
代码示例来源: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: myxh/CoolShopping
private int getScrollRange() {
return (int) Math.max(0, FloatMath.floor(mRefreshableView.getContentHeight() * mRefreshableView.getScale())
- (getHeight() - getPaddingBottom() - getPaddingTop()));
}
}
代码示例来源:origin: Uphie/ONE-Unofficial
private int getScrollRange() {
return (int) Math.max(0, FloatMath.floor(mRefreshableView.getContentHeight() * mRefreshableView.getScale())
- (getHeight() - getPaddingBottom() - getPaddingTop()));
}
}
代码示例来源:origin: huangfangyi/FanXin
private int getScrollRange() {
return (int) Math.max(0, FloatMath.floor(mRefreshableView.getContentHeight() * mRefreshableView.getScale())
- (getHeight() - getPaddingBottom() - getPaddingTop()));
}
}
代码示例来源: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: myxh/CoolShopping
@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: 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);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!