本文整理了Java中android.widget.ScrollView.getHeight()
方法的一些代码示例,展示了ScrollView.getHeight()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ScrollView.getHeight()
方法的具体详情如下:
包路径:android.widget.ScrollView
类名称:ScrollView
方法名:getHeight
暂无
代码示例来源:origin: florent37/MaterialViewPager
static boolean canScroll(View view) {
if (view instanceof ScrollView) {
ScrollView scrollView = (ScrollView) view;
View child = scrollView.getChildAt(0);
if (child != null) {
int childHeight = child.getHeight();
return scrollView.getHeight() < childHeight + scrollView.getPaddingTop() + scrollView.getPaddingBottom();
}
return false;
} else if (view instanceof RecyclerView) {
RecyclerView recyclerView = (RecyclerView) view;
int yOffset = recyclerView.computeVerticalScrollOffset();
return yOffset != 0;
}
return true;
}
代码示例来源:origin: Aspsine/SwipeToLoadLayout
@Override
public void onScrollChanged() {
if (scrollView.getChildAt(0).getHeight() < scrollView.getScrollY() + scrollView.getHeight() && !ViewCompat.canScrollVertically(scrollView, 1)) {
swipeToLoadLayout.setLoadingMore(true);
}
}
};
代码示例来源:origin: umano/AndroidSlidingUpPanel
ScrollView sv = ((ScrollView) scrollableView);
View child = sv.getChildAt(0);
return (child.getBottom() - (sv.getHeight() + sv.getScrollY()));
代码示例来源:origin: aa112901/remusic
.getChildAt(scrollView.getChildCount() - 1);
if (view != null) {
int diff = (view.getBottom() - (scrollView.getHeight() + scrollView
.getScrollY()));
if (diff == 0) {
代码示例来源:origin: nuptboyzhb/SuperSwipeRefreshLayout
.getChildAt(scrollView.getChildCount() - 1);
if (view != null) {
int diff = (view.getBottom() - (scrollView.getHeight() + scrollView
.getScrollY()));
if (diff == 0) {
代码示例来源: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: envyfan/AndroidReview
public void run() {
if (scroll == null || inner == null) {
return;
}
int offset = inner.getMeasuredHeight() - scroll.getHeight();
if (offset < 0) {
offset = 0;
}
scroll.smoothScrollTo(0, offset);
}
});
代码示例来源:origin: animalize/QuanTangshi
private void setYPosi(float posi) {
if (posi != 0) {
int t = (int) (root.getHeight() * posi);
root.scrollTo(0, t);
}
}
代码示例来源:origin: stackoverflow.com
public void onWindowFocusChanged (boolean hasFocus)
{
super.onWindowFocusChanged(hasFocus);
ScrollView scrollView = (ScrollView) findViewById(R.id.svtest);
int width = scrollView.getWidth();
int height = scrollView.getHeight();
}
代码示例来源:origin: stackoverflow.com
final ScrollView myScroll = (ScrollView)findViewById(R.id.my_scroll);
ViewTreeObserver vto = myScroll.getViewTreeObserver();
vto.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
LayerDrawable ld = (LayerDrawable)myScroll.getBackground();
height = myScroll.getHeight();
width=myScroll.getHeight();
ViewTreeObserver obs = myScroll.getViewTreeObserver();
obs.removeOnGlobalLayoutListener(this);
}
});
代码示例来源:origin: wallabag/android-app
private double getReadingPosition() {
int yOffset = scrollView.getScrollY();
int viewHeight = scrollView.getHeight();
int totalHeight = scrollView.getChildAt(0).getHeight();
Log.v(TAG, "getReadingPosition() yOffset: " + yOffset + ", viewHeight: " + viewHeight
+ ", totalHeight: " + totalHeight);
totalHeight -= viewHeight;
double position = totalHeight >= 0 ? yOffset * 1. / totalHeight : 0;
if(position > 100) position = 100;
Log.d(TAG, "getReadingPosition() position: " + position);
return position;
}
代码示例来源:origin: com.albedinsky.android/ui
/**
*/
@Override
public boolean isScrolledAtEnd() {
final View view = mScrollableView.getChildAt(0);
return view != null && (view.getHeight() - mScrollableView.getHeight()) == mScrollableView.getScrollY();
}
}
代码示例来源:origin: com.albedinsky.android/ui-widget-layout
/**
*/
@Override
public boolean isScrolledAtEnd() {
final View view = mScrollableView.getChildAt(0);
return view != null && (view.getHeight() - mScrollableView.getHeight()) == mScrollableView.getScrollY();
}
}
代码示例来源:origin: stackoverflow.com
ScrollView scrollView = (ScrollView) findViewById(R.id.ScrollView);
LinearLayout linearLayout = (LinearLayout) findViewById(R.id.LinearLayout);
if(linearLayout.getMeasuredHeight() <= scrollView.getScrollY() +
scrollView.getHeight()) {
//do something
}
else {
//do nothing
}
代码示例来源:origin: stackoverflow.com
ScrollView scrollView = (ScrollView) findViewById(R.id.scrollview);
LinearLayout linearLayout = (LinearLayout) findViewById(R.id.layout);
if(linearLayout.getMeasuredHeight() <= scrollView.getScrollY() +
scrollView.getHeight()) {
//scroll view is at the very bottom
}
else {
//scroll view is in somewhere middle
}
代码示例来源:origin: a284628487/TaoBaoDetailView
@Override
public boolean headerFootReached(MotionEvent event) {
if (mHeader.getScrollY() + mHeader.getHeight() >= mHeaderContent
.getHeight()) {
return true;
}
return false;
}
代码示例来源:origin: lime-ime/limeime
private void scrollToRow(int row) {
int selY = row * (mHeight + mVerticalPadding);
int scrollY = mParentScrollView.getScrollY();
int scrollHeight = mParentScrollView.getHeight();
if (DEBUG) Log.i(TAG, "scrollToRow(), row=" + row
+ ", selected row y=" + selY
+ ", ScrollViewHeight" + scrollHeight
+ ", ScollY=" + scrollY);
if (selY < scrollY || selY > (scrollY + scrollHeight))
mParentScrollView.scrollTo(0, row * ((mHeight + mVerticalPadding)));
}
代码示例来源:origin: quaap/LaunchTime
private void scrollOnDrag(View view, DragEvent event, ScrollView scrollView) {
float ty = view.getTop() + event.getY();
if (isAncestor(scrollView, view)) {
int thresh = scrollView.getHeight() / 6;
if (ty < scrollView.getScrollY() + thresh) {
scrollView.smoothScrollBy(0, -10);
} else if (ty > scrollView.getScrollY() + scrollView.getHeight() - thresh) {
scrollView.smoothScrollBy(0, 10);
}
}
}
代码示例来源:origin: stackoverflow.com
public static void bringPointIntoView (TextView textView,
ScrollView scrollView, int offset)
{
int line = textView.getLayout ().getLineForOffset (offset);
int y = (int) ((line + 0.5) * textView.getLineHeight ());
scrollView.smoothScrollTo (0, y - scrollView.getHeight () / 2);
}
代码示例来源:origin: stackoverflow.com
final ScrollView scrollView = (ScrollView) findViewById(R.id.consoleTab);
TextView textView = (TextView) findViewById(R.id.consoleView);
boolean autoScroll = (textView.getBottom() - (scrollView.getHeight() + scrollView.getScrollY())) <= 0;
textView.setText(state.getConsole().getText());
if (autoScroll) {
scrollView.post(new Runnable() {
public void run() {
scrollView.fullScroll(ScrollView.FOCUS_DOWN);
}
});
}
内容来源于网络,如有侵权,请联系作者删除!