當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。