本文整理了Java中android.widget.ImageView.getMeasuredHeight()
方法的一些代码示例,展示了ImageView.getMeasuredHeight()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ImageView.getMeasuredHeight()
方法的具体详情如下:
包路径:android.widget.ImageView
类名称:ImageView
方法名:getMeasuredHeight
暂无
代码示例来源:origin: ittianyu/BottomNavigationViewEx
@Override
public void run() {
// System.out.println("mIcon.getMeasuredHeight():" + mIcon.getMeasuredHeight());
setItemHeight(mItemHeight - mIcon.getMeasuredHeight());
}
});
代码示例来源:origin: stackoverflow.com
int finalHeight, finalWidth;
final ImageView iv = (ImageView)findViewById(R.id.scaled_image);
final TextView tv = (TextView)findViewById(R.id.size_label);
ViewTreeObserver vto = iv.getViewTreeObserver();
vto.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
public boolean onPreDraw() {
iv.getViewTreeObserver().removeOnPreDrawListener(this);
finalHeight = iv.getMeasuredHeight();
finalWidth = iv.getMeasuredWidth();
tv.setText("Height: " + finalHeight + " Width: " + finalWidth);
return true;
}
});
代码示例来源:origin: stackoverflow.com
int finalHeight, finalWidth;
final ImageView iv = (ImageView)findViewById(R.id.scaled_image);
final TextView tv = (TextView)findViewById(R.id.size_label);
ViewTreeObserver vto = iv.getViewTreeObserver();
vto.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
public boolean onPreDraw() {
// Remove after the first run so it doesn't fire forever
iv.getViewTreeObserver().removeOnPreDrawListener(this);
finalHeight = iv.getMeasuredHeight();
finalWidth = iv.getMeasuredWidth();
tv.setText("Height: " + finalHeight + " Width: " + finalWidth);
return true;
}
});
代码示例来源:origin: jdsjlzx/LRecyclerView
private void initView() {
LayoutParams lp = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
lp.setMargins(0, 0, 0, 0);
this.setLayoutParams(lp);
this.setPadding(0, 0, 0, 0);
inflate(getContext(), R.layout.qzone_header, this);
mHeaderView = findViewById(R.id.iv_header);
mRefreshView = findViewById(R.id.iv_refresh);
measure(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
mHeaderViewHeight = mHeaderView.getMeasuredHeight();
mDeltaHeight = getMeasuredHeight() - mHeaderViewHeight;
mRefreshHideTranslationY = -mRefreshView.getMeasuredHeight() - 20;
mRefreshShowTranslationY = mRefreshView.getMeasuredHeight();
}
代码示例来源:origin: jdsjlzx/LRecyclerView
private void initView() {
LayoutParams lp = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
lp.setMargins(0, 0, 0, 0);
this.setLayoutParams(lp);
this.setPadding(0, 0, 0, 0);
inflate(getContext(), R.layout.moments_header, this);
mRefreshView = findViewById(R.id.iv_refresh);
measure(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
mHeaderViewHeight = getMeasuredHeight();
mRefreshHideTranslationY = -mRefreshView.getMeasuredHeight() - 20;
mRefreshShowTranslationY = mRefreshView.getMeasuredHeight();
}
代码示例来源:origin: Clans/FloatingActionButton
int imageTop = menuButtonTop + mMenuButton.getMeasuredHeight() / 2 - mImageToggle.getMeasuredHeight() / 2;
imageTop + mImageToggle.getMeasuredHeight());
代码示例来源:origin: stackoverflow.com
ImageView iv=(ImageView)findViewById(R.id.image);
ViewTreeObserver vto = iv.getViewTreeObserver();
vto.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
public boolean onPreDraw() {
finalHeight = iv.getMeasuredHeight();
finalWidth = iv.getMeasuredWidth();
Log.e("hilength","Height: " + finalHeight + " Width: " + finalWidth);
return true;
}
});
代码示例来源:origin: stackoverflow.com
float r = newRot - d;
matrix.postRotate(r, view.getMeasuredWidth() / 2,
view.getMeasuredHeight() / 2);
代码示例来源:origin: skydoves/ColorPickerView
/**
* gets a selector's selected coordinate y.
*
* @return a selected coordinate y.
*/
public float getSelectorY() {
return selector.getY() - (selector.getMeasuredHeight() / 2);
}
代码示例来源:origin: skydoves/ColorPickerView
/**
* gets center coordinate of the selector.
*
* @param x coordinate x.
* @param y coordinate y.
* @return the center coordinate of the selector.
*/
private Point getCenterPoint(int x, int y) {
return new Point(
x - (selector.getMeasuredWidth() / 2), y - (selector.getMeasuredHeight() / 2));
}
代码示例来源:origin: WangShuo1143368701/VideoView
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
params.x = (int) (motionEvent.getRawX() - mCaptureIv.getMeasuredWidth() / 2);
params.y = (int) (motionEvent.getRawY() - mCaptureIv.getMeasuredHeight() / 2 - 20);
wm.updateViewLayout(mCaptureLl, params);
return false;
}
});
代码示例来源:origin: adolfAn/FBReader_AS
protected void moveCursor() {
float y = viewHue.getMeasuredHeight() - (getHue() * viewHue.getMeasuredHeight() / 360.f);
if (y == viewHue.getMeasuredHeight()) y = 0.f;
RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) viewCursor.getLayoutParams();
layoutParams.leftMargin = (int) (viewHue.getLeft() - Math.floor(viewCursor.getMeasuredWidth() / 2) - viewContainer.getPaddingLeft());
;
layoutParams.topMargin = (int) (viewHue.getTop() + y - Math.floor(viewCursor.getMeasuredHeight() / 2) - viewContainer.getPaddingTop());
;
viewCursor.setLayoutParams(layoutParams);
}
代码示例来源:origin: yukuku/ambilwarna
protected void moveAlphaCursor() {
final int measuredHeight = this.viewAlphaCheckered.getMeasuredHeight();
float y = measuredHeight - ((this.getAlpha() * measuredHeight) / 255.f);
final RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) this.viewAlphaCursor.getLayoutParams();
layoutParams.leftMargin = (int) (this.viewAlphaCheckered.getLeft() - Math.floor(this.viewAlphaCursor.getMeasuredWidth() / 2) - this.viewContainer.getPaddingLeft());
layoutParams.topMargin = (int) ((this.viewAlphaCheckered.getTop() + y) - Math.floor(this.viewAlphaCursor.getMeasuredHeight() / 2) - this.viewContainer.getPaddingTop());
this.viewAlphaCursor.setLayoutParams(layoutParams);
}
代码示例来源:origin: xuehuayous/PullToRefresh-Demo
@Override
public void onPull(float scaleOfLayout) {
scaleOfLayout = scaleOfLayout > 1.0f ? 1.0f : scaleOfLayout;
//缩放动画
ViewHelper.setPivotY(mBabyImage, mBabyImage.getMeasuredHeight()); // 设置中心点
ViewHelper.setPivotX(mBabyImage, mBabyImage.getMeasuredWidth() / 2);
ObjectAnimator animPX = ObjectAnimator.ofFloat(mBabyImage, "scaleX", 0, 1).setDuration(300);
animPX.setCurrentPlayTime((long) (scaleOfLayout * 300));
ObjectAnimator animPY = ObjectAnimator.ofFloat(mBabyImage, "scaleY", 0, 1).setDuration(300);
animPY.setCurrentPlayTime((long) (scaleOfLayout * 300));
}
代码示例来源:origin: L4Digital/FastScroll
private void updateViewHeights() {
int measureSpec = MeasureSpec.makeMeasureSpec(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);
bubbleView.measure(measureSpec, measureSpec);
bubbleHeight = bubbleView.getMeasuredHeight();
handleView.measure(measureSpec, measureSpec);
handleHeight = handleView.getMeasuredHeight();
}
代码示例来源:origin: skydoves/ColorPickerView
/**
* changes selector's selected point without notifies.
*
* @param x coordinate x of the selector.
* @param y coordinate y of the selector.
*/
public void setCoordinate(int x, int y) {
selector.setX(x - (selector.getMeasuredWidth() / 2));
selector.setY(y - (selector.getMeasuredHeight() / 2));
}
代码示例来源:origin: yukuku/androidbible
protected void moveTarget() {
float x = getSat() * viewSatVal.getMeasuredWidth();
float y = (1.f - getVal()) * viewSatVal.getMeasuredHeight();
RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) viewTarget.getLayoutParams();
layoutParams.leftMargin = (int) (viewSatVal.getLeft() + x - Math.floor(viewTarget.getMeasuredWidth() / 2) - viewContainer.getPaddingLeft());
layoutParams.topMargin = (int) (viewSatVal.getTop() + y - Math.floor(viewTarget.getMeasuredHeight() / 2) - viewContainer.getPaddingTop());
viewTarget.setLayoutParams(layoutParams);
}
代码示例来源:origin: konradrenner/kolabnotes-android
protected void moveTarget() {
float x = getSat() * viewSatVal.getMeasuredWidth();
float y = (1.f - getVal()) * viewSatVal.getMeasuredHeight();
RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) viewTarget.getLayoutParams();
layoutParams.leftMargin = (int) (viewSatVal.getLeft() + x - Math.floor(viewTarget.getMeasuredWidth() / 2) - viewContainer.getPaddingLeft());
layoutParams.topMargin = (int) (viewSatVal.getTop() + y - Math.floor(viewTarget.getMeasuredHeight() / 2) - viewContainer.getPaddingTop());
viewTarget.setLayoutParams(layoutParams);
}
代码示例来源:origin: L4Digital/FastScroll
private void setViewPositions(float y) {
bubbleHeight = bubbleView.getMeasuredHeight();
handleHeight = handleView.getMeasuredHeight();
int bubbleY = getValueInRange(0, viewHeight - bubbleHeight - handleHeight / 2, (int) (y - bubbleHeight));
int handleY = getValueInRange(0, viewHeight - handleHeight, (int) (y - handleHeight / 2));
if (showBubble) {
bubbleView.setY(bubbleY);
}
handleView.setY(handleY);
}
代码示例来源:origin: xuehuayous/PullToRefresh-Demo
@Override
public void onPull(float scaleOfLayout) {
if(scaleOfLayout < 0.7f) scaleOfLayout = 0.7f;
if(scaleOfLayout > 1.0f) scaleOfLayout = 1.0f;
//旋转动画
ViewHelper.setPivotX(mPointerImage, mPointerImage.getMeasuredWidth()/2); // 设置中心点
ViewHelper.setPivotY(mPointerImage, mPointerImage.getMeasuredHeight()/2);
ObjectAnimator animPY = ObjectAnimator.ofFloat(mPointerImage, "rotation", 0, 250).setDuration(300);
animPY.setCurrentPlayTime((long) (scaleOfLayout * 1000 - 700));
}
内容来源于网络,如有侵权,请联系作者删除!