本文整理了Java中android.widget.ImageView.getY()
方法的一些代码示例,展示了ImageView.getY()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ImageView.getY()
方法的具体详情如下:
包路径:android.widget.ImageView
类名称:ImageView
方法名:getY
暂无
代码示例来源:origin: JasonQS/Anti-recall
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
difAdjuster = adjuster.getY() - event.getRawY();
downY = event.getRawY();
heightAll = recyclerViewAll.getLayoutParams().height;
heightRecalled = recyclerViewRecalled.getLayoutParams().height;
break;
case MotionEvent.ACTION_MOVE:
float dif = event.getRawY() - downY;
int v1 = (int) (heightAll + dif);
int v2 = (int) (heightRecalled - dif);
if (v1 < 0 || v1 > App.layoutHeight || v2 < 0 | v2 > App.layoutHeight)
break;
setRecyclerViewAllHeight(v1);
setRecyclerViewRecalledHeight(v2);
adjuster.setY(App.adjusterY = event.getRawY() + difAdjuster);
break;
}
return true;
}
});
代码示例来源:origin: JasonQS/Anti-recall
private void onMeasured() {
if (App.layoutHeight != -1)
return;
App.layoutHeight = relativeLayout.getHeight();
if (App.isShowAllQQMessages) {
setRecyclerViewAllHeight(App.layoutHeight / 2);
setRecyclerViewRecalledHeight(App.layoutHeight / 2);
} else
setRecyclerViewAllHeight(App.layoutHeight);
App.adjusterY = App.adjusterOriginalY = adjuster.getY();
}
代码示例来源:origin: skydoves/ColorPickerView
/**
* gets a selector's selected coordinate y.
*
* @return a selected coordinate y.
*/
public float getSelectorY() {
return selector.getY() - (selector.getMeasuredHeight() / 2);
}
代码示例来源:origin: stackoverflow.com
public void up(final ImageView i){
CountDownTimer start = new CountDownTimer(100, 100) {
@Override
public void onTick(long millisUntilFinished) {
//i.setY(i.getY() - 10);
i.animate().translationYBy(i.getY() - 10).setDuration(1000);
}
@Override
public void onFinish() {
//i.setY(i.getY() - 10);
i.animate().translationYBy(i.getY() - 10).setDuration(1000);
}
}.start();
代码示例来源:origin: skydoves/ColorPickerPreference
public float getSelectorY() {
return selector.getY() - getSelectorHalfHeight();
}
代码示例来源:origin: stackoverflow.com
public boolean collision(ImageView a, ImageView b){
float bl = a.getY();
float bt = a.getX();
float br = a.getWidth() + bl;
float bb = a.getHeight() + bt;
float pl = b.getY();
float pt = b.getX();
float pr = b.getWidth() + pl;
float pb = b.getHeight() + pt;
if (bl <= pr && bl >= pl && bt >= pt && bt <= pb) {
return true;
} else if (br >= pl && br <= pr && bb >= pt && bb <= pb) {
return true;
} else if (bt <= pb && bt >= pt && br >= pl && br <= pr) {
return true;
} else if (bb >= pt && bb <= pb && bl >= pl && bl <= pr) {
return true;
}
return false;
}
代码示例来源:origin: google/santa-tracker-android
final float shareImageY = shareImage.getY();
final float finalStarsY = finalStars.getY();
shareImage.setY(shareImageY + SHARE_Y_OFFSET_PX);
代码示例来源:origin: stackoverflow.com
public boolean collision(ImageView a, ImageView b){
float bl = a.getY();
float bt = a.getX();
float br = a.getWidth() + bl;
float bb = a.getHeight() + bt;
float pl = b.getY();
float pt = b.getX();
float pr = b.getWidth() + pl;
float pb = b.getHeight() + pt;
if (bl <= pr && bl >= pl && bt >= pt && bt <= pb) {
return true;
} else if (br >= pl && br <= pr && bb >= pt && bb <= pb) {
return true;
} else if (bt <= pb && bt >= pt && br >= pl && br <= pr) {
return true;
} else if (bb >= pt && bb <= pb && bl >= pl && bl <= pr) {
return true;
}
return false;
}
代码示例来源:origin: stackoverflow.com
ImageView iv = (ImageView)findViewById(R.id.image_view);
Drawable d = iv.getDrawable();
Rect bounds = d.getBounds();
int top = iv.getY() + bounds.top;
int left = iv.getX() + bounds.left;
代码示例来源:origin: Muyangmin/UltraPtrHeaderCollection
@Override
protected void dispatchDraw(Canvas canvas) {
if (imgMars != null && imgMarsCircle != null) {
canvas.save();
canvas.translate(imgMars.getX(), imgMars.getY());
float ballScale = 0.7F * ptrPullDownPercent + 0.3F;
canvas.scale(ballScale, ballScale, imgMars.getWidth() / 2.0F, 0.0F);
imgMars.draw(canvas);
canvas.restore();
if (isRefreshing) {
canvas.save();
float translateY = ((imgMars.getHeight() - imgMarsCircle.getHeight()) / 2.0F) *
circleTranslateY;
float scaleX = 0.7F * circleScaleX + 0.3F;
canvas.translate(imgMarsCircle.getX(), imgMarsCircle.getY() + translateY);
canvas.scale(scaleX, scaleX, imgMarsCircle.getWidth() / 2.0F, imgMarsCircle.getHeight()/2.0F);
imgMarsCircle.draw(canvas);
canvas.restore();
}
}
}
代码示例来源:origin: andyb129/ClockScroller
private void setRecyclerViewPosition(float y) {
if (recyclerView != null) {
int itemCount = recyclerView.getAdapter().getItemCount();
float proportion;
if (handle.getY() == 0) {
proportion = 0f;
} else if (handle.getY() + handle.getHeight() >= height - TRACK_SNAP_RANGE) {
proportion = 1f;
} else {
proportion = y / (float) height;
}
int targetPos = getValueInRange(0, itemCount - 1, (int) (proportion * (float) itemCount));
((LinearLayoutManager) recyclerView.getLayoutManager()).scrollToPositionWithOffset(targetPos, 0);
if (recyclerView.getAdapter() instanceof DateGetter) {
bubbleDate = ((DateGetter) recyclerView.getAdapter()).getDateFromAdapter(targetPos);
}
handleText.setText(sdf.format(bubbleDate));
clockDrawable.start(bubbleDate);
bubble.setImageDrawable(clockDrawable);
}
}
代码示例来源:origin: stackoverflow.com
final ImageView temp = (ImageView) findViewById(R.id.fivetwo);
ViewTreeObserver vto = temp.getViewTreeObserver();
vto.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
temp.getViewTreeObserver().removeGlobalOnLayoutListener(this);
int x = temp.getX();
int y = temp.getY();
Log.v(TAG, String.format("X:%d Y:%d",x,y);
}
});
代码示例来源:origin: livroandroid/5ed
public void onClickAnimarAPI(View view) {
ImageView img = (ImageView) findViewById(R.id.img);
float y = img.getY();
ObjectAnimator alphaAnim = ObjectAnimator.ofFloat(img, "alpha", 1f, 0f);
ObjectAnimator translateAnim = ObjectAnimator.ofFloat(img, "y", y, img.getHeight() * 2);
// Fazemos o reverse manual aqui
alphaAnim.setRepeatCount(1);
alphaAnim.setRepeatMode(Animation.REVERSE);
translateAnim.setRepeatCount(1);
translateAnim.setRepeatMode(Animation.REVERSE);
AnimatorSet lista = new AnimatorSet();
lista.playTogether(translateAnim, alphaAnim);
animar(lista);
}
代码示例来源:origin: akshay2211/PixImagePicker
private void setRecyclerViewPosition(float y) {
if (recyclerView != null && recyclerView.getAdapter() != null) {
int itemCount = recyclerView.getAdapter().getItemCount();
float proportion;
if (mHandleView.getY() == 0) {
proportion = 0f;
} else if (mHandleView.getY() + mHandleView.getHeight() >= mViewHeight - sTrackSnapRange) {
proportion = 1f;
} else {
proportion = y / mViewHeight;
}
int scrolledItemCount = Math.round(proportion * itemCount);
int targetPos = Utility.getValueInRange(0, itemCount - 1, scrolledItemCount);
recyclerView.getLayoutManager().scrollToPosition(targetPos);
if (mainImageAdapter != null) {
String text = mainImageAdapter.getSectionMonthYearText(targetPos);
mBubbleView.setText(text);
if (text.equalsIgnoreCase("")) {
mBubbleView.setVisibility(View.GONE);
}
}
}
}
代码示例来源:origin: L4Digital/FastScroll
private void setRecyclerViewPosition(float y) {
if (recyclerView != null && recyclerView.getAdapter() != null) {
int itemCount = recyclerView.getAdapter().getItemCount();
float proportion;
if (handleView.getY() == 0) {
proportion = 0f;
} else if (handleView.getY() + handleHeight >= viewHeight - TRACK_SNAP_RANGE) {
proportion = 1f;
} else {
proportion = y / (float) viewHeight;
}
int scrolledItemCount = Math.round(proportion * itemCount);
if (isLayoutReversed(recyclerView.getLayoutManager())) {
scrolledItemCount = itemCount - scrolledItemCount;
}
int targetPos = getValueInRange(0, itemCount - 1, scrolledItemCount);
recyclerView.getLayoutManager().scrollToPosition(targetPos);
if (showBubble && sectionIndexer != null) {
bubbleView.setText(sectionIndexer.getSectionText(targetPos));
}
}
}
代码示例来源:origin: stackoverflow.com
final ImageView imageview = (ImageView) findViewById(R.id.imageView);
final ValueAnimator translateAnimator = ValueAnimator.ofFloat(0.0f, 1.0f);
ObjectAnimator rotateAnimator = ObjectAnimator.ofFloat(imageview, "rotation", 0f, 90f);
final AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(translateAnimator, rotateAnimator);
animatorSet.setDuration(4000);
final float x = imageview.getX();
final float y = imageview.getY();
translateAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
float t = (Float) translateAnimator.getAnimatedValue();
imageview.setTranslationX(x + t*100); // do your own
imageview.setTranslationY(y + t*100); // thing here
}
});
imageview.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
animatorSet.start();
}
});
代码示例来源:origin: ianhanniballake/TripleSolitaire
/**
* Gets the screen location for the top card in the waste
*
* @return The exact (x,y) position of the top card in the waste
*/
private Point getWasteLoc() {
final RelativeLayout waste = findViewById(R.id.waste);
final ImageView waste1View = findViewById(R.id.waste1);
final float x = waste.getX() + waste.getPaddingLeft() + waste1View.getX() + waste1View.getPaddingLeft();
final float y = waste.getY() + waste.getPaddingTop() + waste1View.getY() + waste1View.getPaddingTop();
return new Point((int) x, (int) y);
}
代码示例来源:origin: ianhanniballake/TripleSolitaire
/**
* Gets the screen location for the given foundation
*
* @param foundationIndex Negative One-based index (-1 through -12)
* @return The exact (x,y) position of the foundation
*/
private Point getFoundationLoc(final int foundationIndex) {
final RelativeLayout foundationLayout = findViewById(R.id.foundation);
final ImageView foundationView = findViewById(getResources().getIdentifier(
"foundation" + (foundationIndex + 1), "id", getPackageName()));
final float x = foundationView.getX() + foundationView.getPaddingLeft() + foundationLayout.getX()
+ foundationLayout.getPaddingLeft();
final float y = foundationView.getY() + foundationView.getPaddingTop() + foundationLayout.getY()
+ foundationLayout.getPaddingTop();
return new Point((int) x, (int) y);
}
代码示例来源:origin: albert-lii/ImageViewer
@Override
public void onClick(View v) {
imagePager.getViewData().setTargetX(imageView.getX());
// 此处注意,获取 Y 轴坐标时,需要根据实际情况来处理《状态栏》的高度,判断是否需要计算进去
imagePager.getViewData().setTargetY(imageView.getY());
imagePager.getViewData().setTargetWidth(imageView.getWidth());
imagePager.getViewData().setTargetHeight(imageView.getHeight());
imagePager.start(new OnTransCallback() {
@Override
public void onStart() {
}
@Override
public void onRunning(float progress) {
}
@Override
public void onEnd() {
setTransparentStatusBar(R.color.colorBlack);
}
});
}
});
代码示例来源:origin: 3llomi/RecordView
protected void onActionDown(RecordButton recordBtn, MotionEvent motionEvent) {
if (recordListener != null)
recordListener.onStart();
animationHelper.setStartRecorded(true);
animationHelper.resetBasketAnimation();
animationHelper.resetSmallMic();
recordBtn.startScale();
slideToCancelLayout.startShimmerAnimation();
initialX = recordBtn.getX();
basketInitialY = basketImg.getY() + 90;
playSound(RECORD_START);
showViews();
animationHelper.animateSmallMicAlpha();
counterTime.setBase(SystemClock.elapsedRealtime());
startTime = System.currentTimeMillis();
counterTime.start();
isSwiped = false;
}
内容来源于网络,如有侵权,请联系作者删除!