當前位置: 首頁>>代碼示例>>Java>>正文


Java ImageView.getTop方法代碼示例

本文整理匯總了Java中android.widget.ImageView.getTop方法的典型用法代碼示例。如果您正苦於以下問題:Java ImageView.getTop方法的具體用法?Java ImageView.getTop怎麽用?Java ImageView.getTop使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.widget.ImageView的用法示例。


在下文中一共展示了ImageView.getTop方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onGlobalLayout

import android.widget.ImageView; //導入方法依賴的package包/類
public void onGlobalLayout() {
    ImageView imageView = this.getImageView();
    if(null != imageView) {
        if(this.mZoomEnabled) {
            int top = imageView.getTop();
            int right = imageView.getRight();
            int bottom = imageView.getBottom();
            int left = imageView.getLeft();
            if(top != this.mIvTop || bottom != this.mIvBottom || left != this.mIvLeft || right != this.mIvRight) {
                this.updateBaseMatrix(imageView.getDrawable());
                this.mIvTop = top;
                this.mIvRight = right;
                this.mIvBottom = bottom;
                this.mIvLeft = left;
            }
        } else {
            this.updateBaseMatrix(imageView.getDrawable());
        }
    }

}
 
開發者ID:leobert-lan,項目名稱:UiLib,代碼行數:22,代碼來源:PhotoViewAttacher.java

示例2: onGlobalLayout

import android.widget.ImageView; //導入方法依賴的package包/類
public void onGlobalLayout() {
    ImageView imageView = getImageView();
    if (imageView == null) {
        return;
    }
    if (this.mZoomEnabled) {
        int top = imageView.getTop();
        int right = imageView.getRight();
        int bottom = imageView.getBottom();
        int left = imageView.getLeft();
        if (top != this.mIvTop || bottom != this.mIvBottom || left != this.mIvLeft || right != this.mIvRight) {
            updateBaseMatrix(imageView.getDrawable());
            this.mIvTop = top;
            this.mIvRight = right;
            this.mIvBottom = bottom;
            this.mIvLeft = left;
            return;
        }
        return;
    }
    updateBaseMatrix(imageView.getDrawable());
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:23,代碼來源:PhotoViewAttacher.java

示例3: onGlobalLayout

import android.widget.ImageView; //導入方法依賴的package包/類
@Override
public void onGlobalLayout() {
    ImageView imageView = getImageView();

    if (null != imageView) {
        if (mZoomEnabled) {
            final int top = imageView.getTop();
            final int right = imageView.getRight();
            final int bottom = imageView.getBottom();
            final int left = imageView.getLeft();

            /**
             * We need to check whether the ImageView's bounds have changed.
             * This would be easier if we targeted API 11+ as we could just use
             * View.OnLayoutChangeListener. Instead we have to replicate the
             * work, keeping track of the ImageView's bounds and then checking
             * if the values change.
             */
            if (top != mIvTop || bottom != mIvBottom || left != mIvLeft
                    || right != mIvRight) {
                // Update our base matrix, as the bounds have changed
                updateBaseMatrix(imageView.getDrawable());

                // Update values as something has changed
                mIvTop = top;
                mIvRight = right;
                mIvBottom = bottom;
                mIvLeft = left;
            }
        } else {
            updateBaseMatrix(imageView.getDrawable());
        }
    }
}
 
開發者ID:joelan,項目名稱:ClouldReader,代碼行數:35,代碼來源:PhotoViewAttacher.java

示例4: onGlobalLayout

import android.widget.ImageView; //導入方法依賴的package包/類
@Override
public final void onGlobalLayout() {
	ImageView imageView = getImageView();

	if (null != imageView && mZoomEnabled) {
		final int top = imageView.getTop();
		final int right = imageView.getRight();
		final int bottom = imageView.getBottom();
		final int left = imageView.getLeft();

		/**
		 * We need to check whether the ImageView's bounds have changed.
		 * This would be easier if we targeted API 11+ as we could just use
		 * View.OnLayoutChangeListener. Instead we have to replicate the
		 * work, keeping track of the ImageView's bounds and then checking
		 * if the values change.
		 */
		if (top != mIvTop || bottom != mIvBottom || left != mIvLeft
				|| right != mIvRight) {
			// Update our base matrix, as the bounds have changed
			updateBaseMatrix(imageView.getDrawable());

			// Update values as something has changed
			mIvTop = top;
			mIvRight = right;
			mIvBottom = bottom;
			mIvLeft = left;
		}
	}
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:31,代碼來源:PhotoViewAttacher.java

示例5: onGlobalLayout

import android.widget.ImageView; //導入方法依賴的package包/類
@Override
public final void onGlobalLayout() {
	ImageView imageView = getImageView();

	if (null != imageView && mZoomEnabled) {
		final int top = imageView.getTop();
		final int right = imageView.getRight();
		final int bottom = imageView.getBottom();
		final int left = imageView.getLeft();

		/**
		 * We need to check whether the ImageView's bounds have changed.
		 * This would be easier if we targeted API 11+ as we could just use
		 * View.OnLayoutChangeListener. Instead we have to replicate the
		 * work, keeping track of the ImageView's bounds and then checking
		 * if the values change.
		 */
		if (top != mIvTop || bottom != mIvBottom || left != mIvLeft || right != mIvRight) {
			// Update our base matrix, as the bounds have changed
			updateBaseMatrix(imageView.getDrawable());

			// Update values as something has changed
			mIvTop = top;
			mIvRight = right;
			mIvBottom = bottom;
			mIvLeft = left;
		}
	}
}
 
開發者ID:turoDog,項目名稱:KTalk,代碼行數:30,代碼來源:PhotoViewAttacher.java

示例6: layoutImage

import android.widget.ImageView; //導入方法依賴的package包/類
void layoutImage(int i, int left, int top, int right, int bottom) {
    final ImageView view = imageViews[i];
    if (view.getLeft() == left && view.getTop() == top && view.getRight() == right
            && view.getBottom() == bottom) {
        return;
    }

    view.layout(left, top, right, bottom);
}
 
開發者ID:ihsanbal,項目名稱:Wiv,代碼行數:10,代碼來源:MediaView.java

示例7: onGlobalLayout

import android.widget.ImageView; //導入方法依賴的package包/類
@Override
public final void onGlobalLayout() {
    ImageView imageView = getImageView();

    if (null != imageView) {
        if (mZoomEnabled) {
            final int top = imageView.getTop();
            final int right = imageView.getRight();
            final int bottom = imageView.getBottom();
            final int left = imageView.getLeft();

            /**
             * We need to check whether the ImageView's bounds have changed.
             * This would be easier if we targeted API 11+ as we could just use
             * View.OnLayoutChangeListener. Instead we have to replicate the
             * work, keeping track of the ImageView's bounds and then checking
             * if the values change.
             */
            if (top != mIvTop || bottom != mIvBottom || left != mIvLeft
                    || right != mIvRight) {
                // Update our base matrix, as the bounds have changed
                updateBaseMatrix(imageView.getDrawable());

                // Update values as something has changed
                mIvTop = top;
                mIvRight = right;
                mIvBottom = bottom;
                mIvLeft = left;
            }
        } else {
            updateBaseMatrix(imageView.getDrawable());
        }
    }
}
 
開發者ID:benniaobuguai,項目名稱:android-project-gallery,代碼行數:35,代碼來源:PhotoViewAttacher.java

示例8: onGlobalLayout

import android.widget.ImageView; //導入方法依賴的package包/類
@Override
public final void onGlobalLayout() {
    ImageView imageView = getImageView();

    if (null != imageView && mZoomEnabled) {
        final int top = imageView.getTop();
        final int right = imageView.getRight();
        final int bottom = imageView.getBottom();
        final int left = imageView.getLeft();

        /**
         * We need to check whether the ImageView's bounds have changed.
         * This would be easier if we targeted API 11+ as we could just use
         * View.OnLayoutChangeListener. Instead we have to replicate the
         * work, keeping track of the ImageView's bounds and then checking
         * if the values change.
         */
        if (top != mIvTop || bottom != mIvBottom || left != mIvLeft || right != mIvRight) {
            // Update our base matrix, as the bounds have changed
            updateBaseMatrix(imageView.getDrawable());

            // Update values as something has changed
            mIvTop = top;
            mIvRight = right;
            mIvBottom = bottom;
            mIvLeft = left;
        }
    }
}
 
開發者ID:mangestudio,項目名稱:GCSApp,代碼行數:30,代碼來源:PhotoViewAttacher.java

示例9: getTranslationInBounds

import android.widget.ImageView; //導入方法依賴的package包/類
/**
 * Given a proposed translation, this will check to ensure that (a) it will not translate the
 * drawable if it has not scaled to larger than the view dimensions and (b) it will not
 * translate the drawable edges back inside the view bounds if it has scaled larger than the
 * view dimensions.
 *
 * @param translation the proposed translation
 * @param imageView   the view containing the drawable to translate
 * @param matrix      the matrix that is currently applied to the drawable
 * @return the proposed translation if satisfying all criteria, else a corrected version that
 * satisfies them.
 */
private static PointF getTranslationInBounds(PointF translation,
                                             @Nullable ImageView imageView,
                                             @Nullable Matrix matrix) {
    if (imageView == null || imageView.getDrawable() == null || matrix == null) {
        return translation;
    }

    RectF drawableBounds = new RectF(imageView.getDrawable().copyBounds());
    RectF viewBounds = new RectF(
            imageView.getLeft(),
            imageView.getTop(),
            imageView.getRight(),
            imageView.getBottom());

    // Update the drawable bounds according to the current matrix
    matrix.mapRect(drawableBounds);

    PointF correctedTranslation = new PointF();
    if (drawableBounds.width() < viewBounds.width()) {
        // Don't allow additional translations if still within the view bounds
        correctedTranslation.x = 0;
    } else {
        // Don't translate more than the current spacing between the drawable and view edges
        if (translation.x > 0) {
            float leftGap = viewBounds.left - drawableBounds.left;
            correctedTranslation.x = translation.x < leftGap ? translation.x : leftGap;
        } else {
            float rightGap = viewBounds.right - drawableBounds.right;
            correctedTranslation.x = translation.x > rightGap ? translation.x : rightGap;
        }
    }

    if (drawableBounds.height() < viewBounds.height()) {
        // Don't allow additional translations if still within the view bounds
        correctedTranslation.y = 0;
    } else {
        // Don't translate more than the current spacing between the drawable and view edges
        if (translation.y > 0) {
            float topGap = viewBounds.top - drawableBounds.top;
            correctedTranslation.y = translation.y < topGap ? translation.y : topGap;
        } else {
            float bottomGap = viewBounds.bottom - drawableBounds.bottom;
            correctedTranslation.y = translation.y > bottomGap ? translation.y : bottomGap;
        }
    }

    return correctedTranslation;
}
 
開發者ID:metagalactic,項目名稱:ScalableImageView,代碼行數:61,代碼來源:ScalableImageView.java


注:本文中的android.widget.ImageView.getTop方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。