本文整理了Java中android.widget.ScrollView.getMeasuredHeight()
方法的一些代码示例,展示了ScrollView.getMeasuredHeight()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ScrollView.getMeasuredHeight()
方法的具体详情如下:
包路径:android.widget.ScrollView
类名称:ScrollView
方法名:getMeasuredHeight
暂无
代码示例来源:origin: rey5137/material
@Override
public void onGlobalLayout() {
showDivider(ll_repeat.getMeasuredHeight() > sv_repeat.getMeasuredHeight());
}
});
代码示例来源:origin: stackoverflow.com
ScrollView scrollView = (ScrollView)findViewById(R.id...);
ViewTreeObserver observer = scrollView.getViewTreeObserver();
observer.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
int viewHeight = scrollView.getMeasuredHeight();
int contentHeight = scrollView.getChildAt(0).getHeight();
if(viewHeight - contentHeight < 0) {
// scrollable
}
}
});
代码示例来源:origin: chaychan/TouTiao
public static boolean isScrollViewToBottom(ScrollView scrollView) {
if (scrollView != null) {
int scrollContentHeight = scrollView.getScrollY() + scrollView.getMeasuredHeight() - scrollView.getPaddingTop() - scrollView.getPaddingBottom();
int realContentHeight = scrollView.getChildAt(0).getMeasuredHeight();
if (scrollContentHeight == realContentHeight) {
return true;
}
}
return false;
}
代码示例来源:origin: stackoverflow.com
ScrollView scrollView = (ScrollView)findViewById(R.id.svtest);
ViewTreeObserver vto = scrollView.getViewTreeObserver();
vto.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
if (Build.VERSION.SDK_INT < 16)
scrollView.getViewTreeObserver().removeGlobalOnLayoutListener(listener);
else
scrollView.getViewTreeObserver().removeOnGlobalLayoutListener(listener);
int width = scrollView.getMeasuredWidth();
int height = scrollView.getMeasuredHeight();
// postpone any calculation depend on it to here.
// regardless what it is. UI or http connection.
}
});
代码示例来源:origin: Hankkin/TaoBaoDetailDemo
@Override
public boolean onTouch(View v, MotionEvent event) {
ScrollView sv = (ScrollView) v;
if (sv.getScrollY() == (sv.getChildAt(0).getMeasuredHeight() - sv
.getMeasuredHeight()) && mCurrentViewIndex == 0)
canPullUp = true;
else
canPullUp = false;
return false;
}
};
代码示例来源:origin: stackoverflow.com
ScrollView scrollView = (ScrollView)findViewById(R.id.contentScrollView);
ImageView imageView = (ImageView)findViewById(R.id.contentImageView);
ViewTreeObserver vto = scrollView.getViewTreeObserver();
vto.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
scrollView.getViewTreeObserver().removeGlobalOnLayoutListener(this);
int width = scrollView.getMeasuredWidth();
int height = scrollView.getMeasuredHeight();
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(layoutParams.MATCH_PARENT, height * 0.8f);
imageView.setLayoutParams(layoutParams);
}
});
代码示例来源:origin: huangweicai/OkLibDemo
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_MOVE:
if (!isCanTouch) {
return false;
}
//getRawX是触摸位置相对于屏幕的坐标,getX是相对于按钮的坐标
wmParams.x = (int) event.getRawX() - mFloatView.getMeasuredWidth() / 2;
//40为状态栏的高度
wmParams.y = (int) event.getRawY() - mFloatView.getMeasuredHeight() / 2 - 40;
//刷新
mWindowManager.updateViewLayout(mFloatView, wmParams);
break;
case MotionEvent.ACTION_DOWN:
if (!isCanTouch) {
return false;
}
startX = (int) event.getRawX();
startY = (int) event.getRawY();
break;
case MotionEvent.ACTION_UP:
isCanTouch = false;
break;
}
return false;
}
});
代码示例来源:origin: vihuela/RAD
public static boolean isScrollViewToBottom(ScrollView scrollView) {
if (scrollView != null) {
int scrollContentHeight = scrollView.getScrollY() + scrollView.getMeasuredHeight() - scrollView.getPaddingTop() - scrollView.getPaddingBottom();
int realContentHeight = scrollView.getChildAt(0).getMeasuredHeight();
if (scrollContentHeight == realContentHeight) {
return true;
}
}
return false;
}
代码示例来源:origin: Justson/AgentWebX5
public static boolean isScrollViewToBottom(ScrollView scrollView) {
if (scrollView != null) {
int scrollContentHeight = scrollView.getScrollY() + scrollView.getMeasuredHeight() - scrollView.getPaddingTop() - scrollView.getPaddingBottom();
int realContentHeight = scrollView.getChildAt(0).getMeasuredHeight();
if (scrollContentHeight == realContentHeight) {
return true;
}
}
return false;
}
代码示例来源:origin: michael-rapp/AndroidMaterialDialog
@Override
public final void onMeasure(final int widthMeasureSpec, final int heightMeasureSpec) {
if (dialog != null &&
dialog.getScrollableArea().isScrollable(ScrollableArea.Area.CONTENT)) {
super.onMeasure(widthMeasureSpec, MeasureSpec
.makeMeasureSpec(dialog.getScrollView().getMeasuredHeight(),
MeasureSpec.EXACTLY));
} else {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
}
代码示例来源:origin: stackoverflow.com
ScrollView sc=new ScrollView(this);
sc.measure(400, 10);
int width = sc.getMeasuredWidth();
int height = sc.getMeasuredHeight();
int left = 100;
int top = 100;
sc.layout(0, top, left + width, top + height);
代码示例来源:origin: antest1/kcanotify
@Override
public void run() {
sv.measure(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
scroll_h_total = sv.getMeasuredHeight();
scroll_h_layout = sv.getHeight();
sv.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
switch (motionEvent.getAction()) {
case MotionEvent.ACTION_DOWN:
int y = (int) motionEvent.getY();
int direction = 1;
if (y < scroll_h_layout / 2) direction = -1;
scroll_touch_count = 0;
autoScrollScheduler = Executors.newSingleThreadScheduledExecutor();
autoScrollScheduler.scheduleAtFixedRate(auto_scroll(direction), 800, 200, TimeUnit.MILLISECONDS);
break;
case MotionEvent.ACTION_UP:
autoScrollScheduler.shutdown();
break;
}
return false;
}
});
}
});
代码示例来源:origin: derry/delion
/**
* Updates the animation.
*
* @param progress How far along the animation is. In the range [0,1], with 1 being done.
*/
private void update(float progress) {
// The dialog container initially starts off translated downward, gradually decreasing
// the translation until it is in the right place on screen.
float containerTranslation = mContainerHeightDifference * progress;
mRequestView.setTranslationY(containerTranslation);
if (mIsButtonBarLockedInPlace) {
// The button bar is translated along the dialog so that is looks like it stays in
// place at the bottom while the entire bottom sheet is translating upwards.
mButtonBar.setTranslationY(-containerTranslation);
// The payment container is sandwiched between the header and the button bar.
// Expansion animates by changing where its "bottom" is, letting its shadows appear
// and disappear as it changes size.
int paymentContainerBottom = Math.min(
mPaymentContainer.getTop() + mPaymentContainer.getMeasuredHeight(),
mButtonBar.getTop());
mPaymentContainer.setBottom(paymentContainerBottom);
}
}
代码示例来源:origin: stackoverflow.com
int scrollViewHeight = mainScrollView.getMeasuredHeight();
代码示例来源:origin: qbaowei/RefreshLoadMoreLayout
} else if (view instanceof ScrollView) {
ScrollView scrollView = (ScrollView) view;
if (scrollView.getScrollY() + scrollView.getHeight() >= scrollView.getMeasuredHeight()) {
return true;
代码示例来源:origin: fengmaolian/AnalyzeRecyclerViewWithBGARefreshLayout
int scrollContentHeight = mScrollView.getScrollY() + mScrollView.getMeasuredHeight() - mScrollView.getPaddingTop() - mScrollView.getPaddingBottom();
int realContentHeight = mScrollView.getChildAt(0).getMeasuredHeight();
if (scrollContentHeight == realContentHeight) {
内容来源于网络,如有侵权,请联系作者删除!