本文整理汇总了Java中android.widget.ImageView.getLeft方法的典型用法代码示例。如果您正苦于以下问题:Java ImageView.getLeft方法的具体用法?Java ImageView.getLeft怎么用?Java ImageView.getLeft使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.ImageView
的用法示例。
在下文中一共展示了ImageView.getLeft方法的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);
}
示例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());
}
}
}
示例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());
}
示例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());
}
}
}
示例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;
}
}
}
示例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;
}
}
}
示例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;
}
}
}
示例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);
}
示例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());
}
}
}
示例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;
}