当前位置: 首页>>代码示例>>Java>>正文


Java ImageView.getHeight方法代码示例

本文整理汇总了Java中android.widget.ImageView.getHeight方法的典型用法代码示例。如果您正苦于以下问题:Java ImageView.getHeight方法的具体用法?Java ImageView.getHeight怎么用?Java ImageView.getHeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.ImageView的用法示例。


在下文中一共展示了ImageView.getHeight方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getWindowDrawingRect

import android.widget.ImageView; //导入方法依赖的package包/类
/**
 * Window上での描画領域を取得します。
 * 当たり判定の矩形を表します。
 *
 * @param outRect 変更を加えるRect
 */
void getWindowDrawingRect(Rect outRect) {
    // Gravityが逆向きなので、矩形の当たり判定も上下逆転(top/bottom)
    // top(画面上で下方向)の判定を多めに設定
    final ImageView iconView = hasActionTrashIcon() ? mActionTrashIconView : mFixedTrashIconView;
    final float iconPaddingLeft = iconView.getPaddingLeft();
    final float iconPaddingTop = iconView.getPaddingTop();
    final float iconWidth = iconView.getWidth() - iconPaddingLeft - iconView.getPaddingRight();
    final float iconHeight = iconView.getHeight() - iconPaddingTop - iconView.getPaddingBottom();
    final float x = mTrashIconRootView.getX() + iconPaddingLeft;
    final float y = mRootView.getHeight() - mTrashIconRootView.getY() - iconPaddingTop - iconHeight;
    final int left = (int) (x - TARGET_CAPTURE_HORIZONTAL_REGION * mMetrics.density);
    final int top = -mRootView.getHeight();
    final int right = (int) (x + iconWidth + TARGET_CAPTURE_HORIZONTAL_REGION * mMetrics.density);
    final int bottom = (int) (y + iconHeight + TARGET_CAPTURE_VERTICAL_REGION * mMetrics.density);
    outRect.set(left, top, right, bottom);
}
 
开发者ID:cheenid,项目名称:FLFloatingButton,代码行数:23,代码来源:TrashView.java

示例2: onPreDraw

import android.widget.ImageView; //导入方法依赖的package包/类
@Override public boolean onPreDraw() {
  ImageView target = this.target.get();
  if (target == null) {
    return true;
  }

  ViewTreeObserver vto = target.getViewTreeObserver();
  if (!vto.isAlive()) {
    return true;
  }

  int width = target.getWidth();
  int height = target.getHeight();

  if (width <= 0 || height <= 0 || target.isLayoutRequested()) {
    return true;
  }

  target.removeOnAttachStateChangeListener(this);
  vto.removeOnPreDrawListener(this);
  this.target.clear();

  this.creator.unfit().resize(width, height).into(target, callback);
  return true;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:26,代码来源:DeferredRequestCreator.java

示例3: calculateIv

import android.widget.ImageView; //导入方法依赖的package包/类
/**
 * 计算点击的ImageView的大小
 *
 * @param iv 点击的ImageView
 */
private void calculateIv(ImageView iv) {
    if (null != iv) {
        // 如果传入ImageView,就按该ImageView计算
        mIvWidth = iv.getWidth();
        mIvHeight = iv.getHeight();

        int[] points = new int[2];
        iv.getLocationInWindow(points);
        mIvX = points[0];
        mIvY = points[1];
    } else {
        // 如果ImageView为空,就宽高设置为0
        mIvWidth = 0;
        mIvHeight = 0;
        // 并且把起点坐标设置0
        mIvX = 0;
        mIvY = 0;
    }
}
 
开发者ID:yhyzgn,项目名称:Widgets,代码行数:25,代码来源:ImgPreCfg.java

示例4: getDefaultHeight

import android.widget.ImageView; //导入方法依赖的package包/类
public int getDefaultHeight() {
    ImageView imageView = this.mViewRef.get();
    if (imageView != null) {
        ViewGroup.LayoutParams params = imageView.getLayoutParams();
        int height = 0;
        if (this.checkActualViewSize && params != null && params.height != -2) {
            height = imageView.getHeight();
        }

        if (height <= 0 && params != null) {
            height = params.height;
        }

        if (height <= 0) {
            height = getImageViewFieldValue(imageView, "mMaxHeight");
        }
        return height;
    } else {
        return 0;
    }
}
 
开发者ID:redleaf2002,项目名称:magic_imageloader_network,代码行数:22,代码来源:ImageViewAware.java

示例5: getTrashIconCenterY

import android.widget.ImageView; //导入方法依赖的package包/类
/**
 * 削除アイコンの中心Y座標を取得します。
 *
 * @return 削除アイコンの中心Y座標
 */
float getTrashIconCenterY() {
    final ImageView iconView = hasActionTrashIcon() ? mActionTrashIconView : mFixedTrashIconView;
    final float iconViewHeight = iconView.getHeight();
    final float iconViewPaddingBottom = iconView.getPaddingBottom();
    final float iconHeight = iconViewHeight - iconView.getPaddingTop() - iconViewPaddingBottom;
    final float y = mRootView.getHeight() - mTrashIconRootView.getY() - iconViewHeight + iconViewPaddingBottom;
    return y + iconHeight / 2;
}
 
开发者ID:cheenid,项目名称:FLFloatingButton,代码行数:14,代码来源:TrashView.java

示例6: convertOriginalInfo

import android.widget.ImageView; //导入方法依赖的package包/类
public void convertOriginalInfo(ImageView oriView) {
    if (oriView == null || oriView.getDrawable() == null) {
        throw new NullPointerException("original ImageView or ImageView drawable must not null");
    }

    //get original ImageView info
    oriView.getImageMatrix().getValues(mOriginalValues);
    Rect oriRect = oriView.getDrawable().getBounds();
    mOriginalWidth = (int) (oriRect.width() * mOriginalValues[Matrix.MSCALE_X]);
    mOriginalHeight = (int) (oriRect.height() * mOriginalValues[Matrix.MSCALE_Y]);

    mOriginalViewWidth = oriView.getWidth();
    mOriginalViewHeight = oriView.getHeight();
    oriView.getLocationOnScreen(mOriginalLocation);
}
 
开发者ID:idisfkj,项目名称:AndroidShareElement,代码行数:16,代码来源:ShareElementInfo.java

示例7: getImageViewWidth

import android.widget.ImageView; //导入方法依赖的package包/类
/**
 * 根据ImageView获得适当的压缩的宽和高
 * 
 * @param imageView
 * @return
 */
private ImageSize getImageViewWidth(ImageView imageView)
{
	ImageSize imageSize = new ImageSize();
	final DisplayMetrics displayMetrics = imageView.getContext()
			.getResources().getDisplayMetrics();
	final LayoutParams params = imageView.getLayoutParams();

	int width = params.width == LayoutParams.WRAP_CONTENT ? 0 : imageView
			.getWidth(); // Get actual image width
	if (width <= 0)
		width = params.width; // Get layout width parameter
	if (width <= 0)
		width = getImageViewFieldValue(imageView, "mMaxWidth"); // Check
																// maxWidth
																// parameter
	if (width <= 0)
		width = displayMetrics.widthPixels;
	int height = params.height == LayoutParams.WRAP_CONTENT ? 0 : imageView
			.getHeight(); // Get actual image height
	if (height <= 0)
		height = params.height; // Get layout height parameter
	if (height <= 0)
		height = getImageViewFieldValue(imageView, "mMaxHeight"); // Check
																	// maxHeight
																	// parameter
	if (height <= 0)
		height = displayMetrics.heightPixels;
	imageSize.width = width;
	imageSize.height = height;
	return imageSize;

}
 
开发者ID:liuyanggithub,项目名称:SuperSelector,代码行数:39,代码来源:ImageLoadUtil.java

示例8: cropBitmap

import android.widget.ImageView; //导入方法依赖的package包/类
/**
 * Crop the bitmap to only the part of the scansegment. The bitmap should only contain the part
 * that displays the MRZ of a travel document.
 * @param bitmap - The bitmap created from the camerapreview
 * @param scanSegment - Scansegment, the segment that should be scanned with OCR
 * @return
 */
public static Bitmap cropBitmap(Bitmap bitmap, ImageView scanSegment) {
    int startX = (int) scanSegment.getX();
    int startY = (int) scanSegment.getY();
    int width = scanSegment.getWidth();
    int length = scanSegment.getHeight();
    return Bitmap.createBitmap(bitmap, startX, startY, width, length);
}
 
开发者ID:digital-voting-pass,项目名称:polling-station-app,代码行数:15,代码来源:CameraFragmentUtil.java

示例9: getScanRect

import android.widget.ImageView; //导入方法依赖的package包/类
/**
 * Get the scan rectangle.
 * @return The rectangle.
 */
public static Rect getScanRect(ImageView scanSegment) {
    int startX = (int) scanSegment.getX();
    int startY = (int) scanSegment.getY();
    int width = scanSegment.getWidth();
    int length = scanSegment.getHeight();
    return new Rect(startX, startY, startX + width, startY + length);
}
 
开发者ID:digital-voting-pass,项目名称:polling-station-app,代码行数:12,代码来源:CameraFragmentUtil.java

示例10: getImageViewHeight

import android.widget.ImageView; //导入方法依赖的package包/类
private int getImageViewHeight(ImageView imageView) {
    return imageView.getHeight() - imageView.getPaddingTop() - imageView.getPaddingBottom();
}
 
开发者ID:BigSea001,项目名称:PhotoPickApp,代码行数:4,代码来源:PhotoViewAttacher.java

示例11: getImageViewHeight

import android.widget.ImageView; //导入方法依赖的package包/类
private int getImageViewHeight(ImageView imageView) {
    if (null == imageView)
        return 0;
    return imageView.getHeight() - imageView.getPaddingTop() - imageView.getPaddingBottom();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:6,代码来源:PhotoViewAttacher.java

示例12: into

import android.widget.ImageView; //导入方法依赖的package包/类
/**
 * Asynchronously fulfills the request into the specified {@link ImageView} and invokes the
 * target {@link Callback} if it's not {@code null}.
 * <p>
 * <em>Note:</em> The {@link Callback} param is a strong reference and will prevent your
 * {@link android.app.Activity} or {@link android.app.Fragment} from being garbage collected. If
 * you use this method, it is <b>strongly</b> recommended you invoke an adjacent
 * {@link Picasso#cancelRequest(android.widget.ImageView)} call to prevent temporary leaking.
 */
public void into(ImageView target, Callback callback) {
  long started = System.nanoTime();
  checkMain();

  if (target == null) {
    throw new IllegalArgumentException("Target must not be null.");
  }

  if (!data.hasImage()) {
    picasso.cancelRequest(target);
    if (setPlaceholder) {
      setPlaceholder(target, getPlaceholderDrawable());
    }
    return;
  }

  if (deferred) {
    if (data.hasSize()) {
      throw new IllegalStateException("Fit cannot be used with resize.");
    }
    int width = target.getWidth();
    int height = target.getHeight();
    if (width == 0 || height == 0 || target.isLayoutRequested()) {
      if (setPlaceholder) {
        setPlaceholder(target, getPlaceholderDrawable());
      }
      picasso.defer(target, new DeferredRequestCreator(this, target, callback));
      return;
    }
    data.resize(width, height);
  }

  Request request = createRequest(started);
  String requestKey = createKey(request);

  if (shouldReadFromMemoryCache(memoryPolicy)) {
    Bitmap bitmap = picasso.quickMemoryCacheCheck(requestKey);
    if (bitmap != null) {
      picasso.cancelRequest(target);
      setBitmap(target, picasso.context, bitmap, MEMORY, noFade, picasso.indicatorsEnabled);
      if (picasso.loggingEnabled) {
        log(OWNER_MAIN, VERB_COMPLETED, request.plainId(), "from " + MEMORY);
      }
      if (callback != null) {
        callback.onSuccess();
      }
      return;
    }
  }

  if (setPlaceholder) {
    setPlaceholder(target, getPlaceholderDrawable());
  }

  Action action =
      new ImageViewAction(picasso, target, request, memoryPolicy, networkPolicy, errorResId,
          errorDrawable, requestKey, tag, callback, noFade);

  picasso.enqueueAndSubmit(action);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:70,代码来源:RequestCreator.java

示例13: checkMatrixBounds

import android.widget.ImageView; //导入方法依赖的package包/类
private void checkMatrixBounds() {
	final ImageView imageView = getImageView();
	if (null == imageView) {
		return;
	}

	final RectF rect = getDisplayRect(getDisplayMatrix());
	if (null == rect) {
		return;
	}

	final float height = rect.height(), width = rect.width();
	float deltaX = 0, deltaY = 0;

	final int viewHeight = imageView.getHeight();
	if (height <= viewHeight) {
		switch (mScaleType) {
			case FIT_START:
				deltaY = -rect.top;
				break;
			case FIT_END:
				deltaY = viewHeight - height - rect.top;
				break;
			default:
				deltaY = (viewHeight - height) / 2 - rect.top;
				break;
		}
	} else if (rect.top > 0) {
		deltaY = -rect.top;
	} else if (rect.bottom < viewHeight) {
		deltaY = viewHeight - rect.bottom;
	}

	final int viewWidth = imageView.getWidth();
	if (width <= viewWidth) {
		switch (mScaleType) {
			case FIT_START:
				deltaX = -rect.left;
				break;
			case FIT_END:
				deltaX = viewWidth - width - rect.left;
				break;
			default:
				deltaX = (viewWidth - width) / 2 - rect.left;
				break;
		}
		mScrollEdge = EDGE_BOTH;
	} else if (rect.left > 0) {
		mScrollEdge = EDGE_LEFT;
		deltaX = -rect.left;
	} else if (rect.right < viewWidth) {
		deltaX = viewWidth - rect.right;
		mScrollEdge = EDGE_RIGHT;
	} else {
		mScrollEdge = EDGE_NONE;
	}

	// Finally actually translate the matrix
	mSuppMatrix.postTranslate(deltaX, deltaY);
}
 
开发者ID:starn,项目名称:encdroidMC,代码行数:61,代码来源:PhotoViewAttacher.java

示例14: checkMatrixBounds

import android.widget.ImageView; //导入方法依赖的package包/类
private void checkMatrixBounds() {
    final ImageView imageView = getImageView();
    if (null == imageView) {
        return;
    }

    final RectF rect = getDisplayRect(getDisplayMatrix());
    if (null == rect) {
        return;
    }

    final float height = rect.height(), width = rect.width();
    float deltaX = 0, deltaY = 0;

    final int viewHeight = imageView.getHeight();
    if (height <= viewHeight) {
        switch (mScaleType) {
            case FIT_START:
                deltaY = -rect.top;
                break;
            case FIT_END:
                deltaY = viewHeight - height - rect.top;
                break;
            default:
                deltaY = (viewHeight - height) / 2 - rect.top;
                break;
        }
    } else if (rect.top > 0) {
        deltaY = -rect.top;
    } else if (rect.bottom < viewHeight) {
        deltaY = viewHeight - rect.bottom;
    }

    final int viewWidth = imageView.getWidth();
    if (width <= viewWidth) {
        switch (mScaleType) {
            case FIT_START:
                deltaX = -rect.left;
                break;
            case FIT_END:
                deltaX = viewWidth - width - rect.left;
                break;
            default:
                deltaX = (viewWidth - width) / 2 - rect.left;
                break;
        }
        mScrollEdge = EDGE_BOTH;
    } else if (rect.left > 0) {
        mScrollEdge = EDGE_LEFT;
        deltaX = -rect.left;
    } else if (rect.right < viewWidth) {
        deltaX = viewWidth - rect.right;
        mScrollEdge = EDGE_RIGHT;
    } else {
        mScrollEdge = EDGE_NONE;
    }

    // Finally actually translate the matrix
    mSuppMatrix.postTranslate(deltaX, deltaY);
}
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:61,代码来源:PhotoViewAttacher.java

示例15: checkMatrixBounds

import android.widget.ImageView; //导入方法依赖的package包/类
private void checkMatrixBounds() {
	final ImageView imageView = getImageView();
	if (null == imageView) {
		return;
	}

	final RectF rect = getDisplayRect(getDisplayMatrix());
	if (null == rect) {
		return;
	}

	final float height = rect.height(), width = rect.width();
	float deltaX = 0, deltaY = 0;

	final int viewHeight = imageView.getHeight();
	if (height <= viewHeight) {
		switch (mScaleType) {
		case FIT_START:
			deltaY = -rect.top;
			break;
		case FIT_END:
			deltaY = viewHeight - height - rect.top;
			break;
		default:
			deltaY = (viewHeight - height) / 2 - rect.top;
			break;
		}
	} else if (rect.top > 0) {
		deltaY = -rect.top;
	} else if (rect.bottom < viewHeight) {
		deltaY = viewHeight - rect.bottom;
	}

	final int viewWidth = imageView.getWidth();
	if (width <= viewWidth) {
		switch (mScaleType) {
		case FIT_START:
			deltaX = -rect.left;
			break;
		case FIT_END:
			deltaX = viewWidth - width - rect.left;
			break;
		default:
			deltaX = (viewWidth - width) / 2 - rect.left;
			break;
		}
		mScrollEdge = EDGE_BOTH;
	} else if (rect.left > 0) {
		mScrollEdge = EDGE_LEFT;
		deltaX = -rect.left;
	} else if (rect.right < viewWidth) {
		deltaX = viewWidth - rect.right;
		mScrollEdge = EDGE_RIGHT;
	} else {
		mScrollEdge = EDGE_NONE;
	}

	// Finally actually translate the matrix
	mSuppMatrix.postTranslate(deltaX, deltaY);
}
 
开发者ID:funnyzhaov,项目名称:Tribe,代码行数:61,代码来源:PhotoViewAttacher.java


注:本文中的android.widget.ImageView.getHeight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。