本文整理了Java中android.widget.ScrollView.measure()
方法的一些代码示例,展示了ScrollView.measure()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ScrollView.measure()
方法的具体详情如下:
包路径:android.widget.ScrollView
类名称:ScrollView
方法名:measure
暂无
代码示例来源: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: WeAreFairphone/FP2-Launcher
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int width = getPaddingLeft() + getPaddingRight() + mContent.getDesiredWidth();
int height = getFolderHeight();
int contentAreaWidthSpec = MeasureSpec.makeMeasureSpec(getContentAreaWidth(),
MeasureSpec.EXACTLY);
int contentAreaHeightSpec = MeasureSpec.makeMeasureSpec(getContentAreaHeight(),
MeasureSpec.EXACTLY);
if (LauncherAppState.isDisableAllApps()) {
// Don't cap the height of the content to allow scrolling.
mContent.setFixedSize(getContentAreaWidth(), mContent.getDesiredHeight());
} else {
mContent.setFixedSize(getContentAreaWidth(), getContentAreaHeight());
}
mScrollView.measure(contentAreaWidthSpec, contentAreaHeightSpec);
mFolderName.measure(contentAreaWidthSpec,
MeasureSpec.makeMeasureSpec(mFolderNameHeight, MeasureSpec.EXACTLY));
setMeasuredDimension(width, height);
}
内容来源于网络,如有侵权,请联系作者删除!