本文整理了Java中android.widget.ImageView.onMeasure()
方法的一些代码示例,展示了ImageView.onMeasure()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ImageView.onMeasure()
方法的具体详情如下:
包路径:android.widget.ImageView
类名称:ImageView
方法名:onMeasure
暂无
代码示例来源:origin: Flipboard/bottomsheet
@SuppressWarnings("UnnecessaryLocalVariable")
@Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int bothDimensionsSpec = widthMeasureSpec;
super.onMeasure(bothDimensionsSpec, bothDimensionsSpec);
}
}
代码示例来源:origin: scwang90/SmartRefreshLayout
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
final View thisView = this;
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
if (Build.VERSION.SDK_INT < 21) {
super.setMeasuredDimension(
thisView.getMeasuredWidth() + mShadowRadius * 2,
thisView.getMeasuredHeight() + mShadowRadius * 2);
}
}
代码示例来源:origin: alexvasilkov/GestureViews
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int width = MeasureSpec.getSize(widthMeasureSpec);
int specWidth = MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY);
int specHeight = MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY);
super.onMeasure(specWidth, specHeight);
}
代码示例来源:origin: siyamed/android-shape-imageview
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
if(getPathHelper().isSquare()) {
super.onMeasure(widthMeasureSpec, widthMeasureSpec);
} else {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
}
代码示例来源:origin: ZieIony/Carbon
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
if (getMeasuredWidth() > maxWidth || getMeasuredHeight() > maxHeight) {
if (getMeasuredWidth() > maxWidth)
widthMeasureSpec = MeasureSpec.makeMeasureSpec(maxWidth, MeasureSpec.EXACTLY);
if (getMeasuredHeight() > maxHeight)
heightMeasureSpec = MeasureSpec.makeMeasureSpec(maxHeight, MeasureSpec.EXACTLY);
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
}
代码示例来源:origin: frogermcs/InstaMaterial
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
int width = getMeasuredWidth();
setMeasuredDimension(width, width);
}
}
代码示例来源:origin: square/picasso
@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
setMeasuredDimension(getMeasuredWidth(), getMeasuredWidth());
}
}
代码示例来源:origin: cymcsg/UltimateAndroid
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
int width = getMeasuredWidth();
setMeasuredDimension(width, width);
}
代码示例来源:origin: steelkiwi/cropiwa
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
if (hasImageSize()) {
placeImageToInitialPosition();
}
}
代码示例来源:origin: siyamed/android-shape-imageview
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
if(square) {
int width = getMeasuredWidth();
int height = getMeasuredHeight();
int dimen = Math.min(width, height);
setMeasuredDimension(dimen, dimen);
}
}
}
代码示例来源:origin: naman14/Timber
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
setMeasuredDimension(getMeasuredWidth(), getMeasuredWidth());
}
}
代码示例来源:origin: code-mc/material-icon-lib
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
if(mDrawable == null){
int size = MaterialIconUtils.convertDpToPx(getContext(), 24);
final int width = MeasureSpec.getMode(widthMeasureSpec);
final int height = MeasureSpec.getMode(heightMeasureSpec);
int paddinghori = getPaddingLeft() + getPaddingRight();
int paddingvert = getPaddingTop() + getPaddingBottom();
if(width == MeasureSpec.UNSPECIFIED && height == MeasureSpec.UNSPECIFIED){
// do nothing, just default 24 dp size
}else if(width == MeasureSpec.UNSPECIFIED){
size = MeasureSpec.getSize(heightMeasureSpec) - paddingvert;
}else if(height == MeasureSpec.UNSPECIFIED){
size = MeasureSpec.getSize(widthMeasureSpec) - paddinghori;
}else{
size = Math.min(MeasureSpec.getSize(heightMeasureSpec) - paddingvert,
MeasureSpec.getSize(widthMeasureSpec) - paddinghori);
}
size = Math.max(0, size);
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
regenerateDrawable();
}else{
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
}
代码示例来源:origin: lovetuzitong/MultiImageSelector
@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
setMeasuredDimension(getMeasuredWidth(), getMeasuredWidth());
}
}
代码示例来源:origin: qiujuer/Genius-Android
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
setMeasuredDimension(getMeasuredWidth() + mShadowRadius * 2, getMeasuredHeight()
+ mShadowRadius * 2);
}
代码示例来源:origin: alibaba/Tangram-Android
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
代码示例来源:origin: gjiazhe/PanoramaImageView
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
mWidth = MeasureSpec.getSize(widthMeasureSpec) - getPaddingLeft() - getPaddingRight();
mHeight = MeasureSpec.getSize(heightMeasureSpec) - getPaddingTop() - getPaddingBottom();
if (getDrawable() != null) {
mDrawableWidth = getDrawable().getIntrinsicWidth();
mDrawableHeight = getDrawable().getIntrinsicHeight();
if (mDrawableWidth * mHeight > mDrawableHeight * mWidth) {
mOrientation = ORIENTATION_HORIZONTAL;
float imgScale = (float) mHeight / (float) mDrawableHeight;
mMaxOffset = Math.abs((mDrawableWidth * imgScale - mWidth) * 0.5f);
} else if(mDrawableWidth * mHeight < mDrawableHeight * mWidth) {
mOrientation = ORIENTATION_VERTICAL;
float imgScale = (float) mWidth / (float) mDrawableWidth;
mMaxOffset = Math.abs((mDrawableHeight * imgScale - mHeight) * 0.5f);
}
}
}
代码示例来源:origin: smuyyh/BookReader
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
if (!elevationSupported()) {
setMeasuredDimension(getMeasuredWidth() + mShadowRadius*2, getMeasuredHeight()
+ mShadowRadius*2);
}
}
代码示例来源:origin: android-cjj/Android-MaterialRefreshLayout
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
if (!elevationSupported()) {
setMeasuredDimension(getMeasuredWidth() + mShadowRadius * 2, getMeasuredHeight()
+ mShadowRadius * 2);
}
}
代码示例来源:origin: Aspsine/SwipeToLoadLayout
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
if (!elevationSupported()) {
setMeasuredDimension(getMeasuredWidth() + mShadowRadius * 2, getMeasuredHeight()
+ mShadowRadius * 2);
}
}
代码示例来源:origin: chentao0707/SimplifyReader
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
return;
} else {
内容来源于网络,如有侵权,请联系作者删除!