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


Java ImageView.getRight方法代码示例

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


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

示例1: onDraw

import android.widget.ImageView; //导入方法依赖的package包/类
@Override
protected void onDraw(Canvas canvas) {
  super.onDraw(canvas);
  int count = mIconsLayout.getChildCount();
  ImageView v = (ImageView) mIconsLayout.getChildAt(mSelectedIndex);
  final int bottom = v.getHeight();
  final int top = bottom - mIndicatorHeight;
  int left = v.getLeft();
  int right = v.getRight();

  if (mSelectedIndex + 1 < count) {
    View nextIcon = mIconsLayout.getChildAt(mSelectedIndex + 1);
    left = (int) (mSelectionOffset * nextIcon.getLeft() +
        (1.0f - mSelectionOffset) * left);
    right = (int) (mSelectionOffset * nextIcon.getRight() +
        (1.0f - mSelectionOffset) * right);
  }

  mIndicatorPaint.setColor(mIndicatorColor);
  canvas.drawRect(left, top, right, bottom, mIndicatorPaint);
}
 
开发者ID:Elias33,项目名称:Quran,代码行数:22,代码来源:IconPageIndicator.java

示例2: 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

示例3: 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

示例4: 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

示例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:weiwenqiang,项目名称:GitHub,代码行数:31,代码来源:PhotoViewAttacher.java

示例6: 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:liuke2016,项目名称:filepicker,代码行数:30,代码来源:PhotoViewAttacher.java

示例7: 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

示例8: 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

示例9: 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

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