本文整理了Java中android.widget.ImageView.getLeft()
方法的一些代码示例,展示了ImageView.getLeft()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ImageView.getLeft()
方法的具体详情如下:
包路径:android.widget.ImageView
类名称:ImageView
方法名:getLeft
暂无
代码示例来源:origin: jiangqqlmj/FastDev4Android
@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;
}
}
}
代码示例来源:origin: wangdan/AisenWeiBo
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;
}
}
}
代码示例来源:origin: wangdan/AisenWeiBo
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;
}
}
}
代码示例来源:origin: stackoverflow.com
ImageView img = (ImageView) findViewById(R.id.image_view);
img.getViewTreeObserver().addOnGlobalLayoutListener(
new ViewTreeObserver.OnGlobalLayoutListener(){
@Override
public void onGlobalLayout() {
int left = img.getLeft();
int top = img.getTop();
//Toast the height and top...
}
});
代码示例来源:origin: stackoverflow.com
//any image view
//must be assigned before use by findViewByID(int id)
ImageView image_view = null;
@Override
public boolean onTouchEvent(MotionEvent event) {
//boundary of your image view
Rect rect = new Rect(image_view.getLeft(),image_view.getTop(),image_view.getRight(),image_view.getBottom());
//if point is inside rect then test_collision = true, else test_collision = false
boolean test_collision = rect.contains((int)event.getX(), (int)event.getY());
return super.onTouchEvent(event);
}
代码示例来源:origin: stackoverflow.com
Rect rect = new Rect();
ImageView iV = new ImageView();
rect.left = iV.getLeft();
rect.top = iV.getTop();
rect.bottom = iV.getBottom();
rect.right = iV.getRight();
代码示例来源:origin: xenione/beforeafter-effect
private void calculateSwipeBounds() {
mRightLimit = mBackgroundImage.getRight() - handlerWidth;
mForegroundView.anchor(mRightLimit, mBackgroundImage.getLeft());
}
代码示例来源:origin: githubliruiyuan/Animation
@Override
public void onGlobalLayout() {
int h1 = centerLayout.getTop();
int h2 = centerLayout.getBottom();
DensityUtil densityUtil = new DensityUtil(MainActivity.this);
int w = densityUtil.getScreenWidth();
fx1 = t3_icon2.getTop() + t3_icon2.getHeight();
fy1 = -t3_icon2.getTop() - t3_icon2.getHeight();
tx1 = -t3_icon2.getWidth() - t3_icon2.getLeft();
ty1 = t3_icon2.getTop() + t3_icon2.getLeft() + t3_icon2.getWidth();
fx2 = t3_icon3.getTop() + t3_icon3.getHeight();
fy2 = -t3_icon3.getTop() - t3_icon3.getHeight();
tx2 = -t3_icon3.getWidth() - t3_icon3.getLeft();
ty2 = t3_icon3.getTop() + t3_icon3.getLeft() + t3_icon3.getWidth();
fx3 = w - t3_icon4.getLeft();
fy3 = -(w - t3_icon4.getLeft());
tx3 = -(h2 - h1 - t3_icon4.getTop());
ty3 = h2 - h1 - t3_icon4.getTop();
fx4 = w - t3_icon5.getLeft();
fy4 = -(w - t3_icon5.getLeft());
tx4 = -(h2 - h1 - t3_icon5.getTop());
ty4 = h2 - h1 - t3_icon5.getTop();
}
});
代码示例来源:origin: stackoverflow.com
ImageView iv = //Code to find the image view
Rect rect = new Rect(iv.getLeft(), iv.getTop(), iv.getRight(), iv.getBottom());
lv.requestChildRectangleOnScreen(lv, rect, false);
代码示例来源:origin: yukuku/androidbible
protected void moveAlphaCursor() {
final int measuredHeight = this.viewAlphaCheckered.getMeasuredHeight();
float y = measuredHeight - ((this.getAlpha() * measuredHeight) / 255.f);
final RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) this.viewAlphaCursor.getLayoutParams();
layoutParams.leftMargin = (int) (this.viewAlphaCheckered.getLeft() - Math.floor(this.viewAlphaCursor.getMeasuredWidth() / 2) - this.viewContainer.getPaddingLeft());
layoutParams.topMargin = (int) ((this.viewAlphaCheckered.getTop() + y) - Math.floor(this.viewAlphaCursor.getMeasuredHeight() / 2) - this.viewContainer.getPaddingTop());
this.viewAlphaCursor.setLayoutParams(layoutParams);
}
代码示例来源:origin: konradrenner/kolabnotes-android
protected void moveAlphaCursor() {
final int measuredHeight = this.viewAlphaCheckered.getMeasuredHeight();
float y = measuredHeight - ((this.getAlpha() * measuredHeight) / 255.f);
final RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) this.viewAlphaCursor.getLayoutParams();
layoutParams.leftMargin = (int) (this.viewAlphaCheckered.getLeft() - Math.floor(this.viewAlphaCursor.getMeasuredWidth() / 2) - this.viewContainer.getPaddingLeft());
layoutParams.topMargin = (int) ((this.viewAlphaCheckered.getTop() + y) - Math.floor(this.viewAlphaCursor.getMeasuredHeight() / 2) - this.viewContainer.getPaddingTop());
this.viewAlphaCursor.setLayoutParams(layoutParams);
}
代码示例来源:origin: ckj375/Android-Sticker
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == REQUEST_FOR_PICTURE && resultCode == RESULT_OK) {
String imgPath = data.getStringExtra(MaterialActivity.MATERIAL_PATH);
// 贴图容器中心点
int centerX = (img.getLeft() + img.getRight()) / 2;
int centerY = (img.getTop() + img.getBottom()) / 2;
Log.v(TAG, "centerX=" + centerX + " centerY=" + centerY);
StickerView view = new StickerView(mContext, imgPath);
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
params.addRule(RelativeLayout.CENTER_IN_PARENT);
view.setLayoutParams(params);
mStickerLayout.addView(view);
}
}
代码示例来源:origin: yukuku/ambilwarna
protected void moveAlphaCursor() {
final int measuredHeight = this.viewAlphaCheckered.getMeasuredHeight();
float y = measuredHeight - ((this.getAlpha() * measuredHeight) / 255.f);
final RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) this.viewAlphaCursor.getLayoutParams();
layoutParams.leftMargin = (int) (this.viewAlphaCheckered.getLeft() - Math.floor(this.viewAlphaCursor.getMeasuredWidth() / 2) - this.viewContainer.getPaddingLeft());
layoutParams.topMargin = (int) ((this.viewAlphaCheckered.getTop() + y) - Math.floor(this.viewAlphaCursor.getMeasuredHeight() / 2) - this.viewContainer.getPaddingTop());
this.viewAlphaCursor.setLayoutParams(layoutParams);
}
代码示例来源:origin: stackoverflow.com
ImageView view = .....
int centerX = (view.getLeft() + view.getRight())/2;
int centerY = (view.getTop() + view.getBottom())/2;
代码示例来源:origin: stackoverflow.com
ImageView imageView=(ImageView)findViewById(R.id.dot_image);
int x=imageView.getRight()-imageView.getLeft();
int y=imageView.getBottom()-imageView.getTop();
TranslateAnimation translate = new TranslateAnimation(
Animation.ABSOLUTE,x, Animation.ABSOLUTE,
x, Animation.ABSOLUTE,y,
Animation.ABSOLUTE,yPosition);
translate.setDuration(150);
translate.setFillEnabled(true);
translate.setFillAfter(true);
imageView.startAnimation(translate);
代码示例来源:origin: wuyr/CatchPiggy
private void layoutDropView(Item item) {
MyLayoutParams layoutParams = (MyLayoutParams) mDropView.getLayoutParams();
if (layoutParams.isDrag) {
mDropView.layout(mDropView.getLeft() + layoutParams.x, mDropView.getTop() + layoutParams.y,
mDropView.getRight() + layoutParams.x, mDropView.getBottom() + layoutParams.y);
} else {
mDropView.layout(0, 0, mDropView.getLayoutParams().width, mDropView.getLayoutParams().height);
mDropView.layout((int) item.getX() - (mDropView.getWidth() - item.getWidth()),
item.getBottom() - mDropView.getHeight(), (int) item.getX() + mDropView.getWidth(), item.getBottom());
}
}
代码示例来源:origin: stackoverflow.com
if (beaconBitmap == null)
{
/* Calculamos las dimensiones si no está creado el bitmap */
beaconView.invalidate();
beaconView.refreshDrawableState();
beaconView.measure(
MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED),
MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
beaconView.layout(0, 0, beaconView.getMeasuredWidth(),
beaconView.getMeasuredHeight());
ImageView ivBeaconType = (ImageView) beaconView
.findViewById(R.id.ivBeaconType);
Rect beaconIconArea = new Rect(ivBeaconType.getLeft(),
ivBeaconType.getTop(), ivBeaconType.getRight(),
ivBeaconType.getBottom());
beaconBitmapCenterX = beaconIconArea.centerX();
beaconBitmapCenterY = beaconIconArea.centerY();
}
代码示例来源:origin: huangfangyi/FanXin
@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;
}
}
}
代码示例来源:origin: andforce/iBeebo
@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;
}
}
}
代码示例来源:origin: vpaliy/android-material-motion
private void setUpReveal() {
int w = panel.getWidth();
int h = panel.getHeight();
final int endRadius = (int) Math.hypot(w, h);
final int cx = (int) (actionButton.getX() + actionButton.getWidth() / 2);
final int cy = (int) (actionButton.getY() + actionButton.getHeight() / 2 - background.getTop());
final float deltaX = cx - (playPause.getLeft() + playPause.getWidth() / 2);
final float deltaY = (cy - getResources().getDimension(R.dimen.play_pause_size) / 2) - (playPause.getTop());
playPause.setTranslationX(deltaX);
playPause.setTranslationY(deltaY);
revealAnimator = ViewAnimationUtils.createCircularReveal(panel, cx, cy, actionButton.getHeight(), endRadius);
revealAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
panel.setVisibility(View.VISIBLE);
actionButton.setVisibility(View.INVISIBLE);
fadeInOutViews(0, duration(R.integer.fade_in_duration));
}
});
revealAnimator.setDuration(duration(R.integer.conceal_duration) / 2);
revealAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
}
内容来源于网络,如有侵权,请联系作者删除!