android.widget.ImageView.getScrollY()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(3.3k)|赞(0)|评价(0)|浏览(123)

本文整理了Java中android.widget.ImageView.getScrollY()方法的一些代码示例,展示了ImageView.getScrollY()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ImageView.getScrollY()方法的具体详情如下:
包路径:android.widget.ImageView
类名称:ImageView
方法名:getScrollY

ImageView.getScrollY介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

<pre>
final float[] getPointerCoords(ImageView view, MotionEvent e)
{
  final int index = e.getActionIndex();
  final float[] coords = new float[] { e.getX(index), e.getY(index) };
  Matrix matrix = new Matrix();
  view.getImageMatrix().invert(matrix);
  matrix.postTranslate(view.getScrollX(), view.getScrollY());
  matrix.mapPoints(coords);
  return coords;
}
</pre>

代码示例来源:origin: stackoverflow.com

final float[] getPointOfTouchedCordinate(ImageView view, MotionEvent e) {

    final int index = e.getActionIndex();
    final float[] coords = new float[] { e.getX(index), e.getY(index) };
    Matrix m = new Matrix();
    view.getImageMatrix().invert(m);
    m.postTranslate(view.getScrollX(), view.getScrollY());
    m.mapPoints(coords);
    return coords;

}

代码示例来源:origin: stackoverflow.com

final float[] getPointerCoords(ImageView view, MotionEvent e)
{
  final int index = e.getActionIndex();
  final float[] coords = new float[] { e.getX(index), e.getY(index) };
  Matrix matrix = new Matrix();
  // invert compute the inverse transformation matrix
  view.getImageMatrix().invert(matrix);
  // this adjust the panning
  matrix.postTranslate(view.getScrollX(), view.getScrollY());
  // this apply the inverse transformation to your touch points
  // which should give you the coordinates on your imageview
  matrix.mapPoints(coords);
  return coords;
}

代码示例来源:origin: matrixxun/PullToZoomInListView

public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
  if (mScrollable) {
    float scrollY = (float) (mHeaderHeight - mHeaderContainer.getBottom());
    if (scrollY > 0.0f && scrollY < ((float) mHeaderHeight)) {
      mHeaderImage.scrollTo(0, -((int) (((double) scrollY) * 0.65d)));
    } else if (mHeaderImage.getScrollY() != 0) {
      mHeaderImage.scrollTo(0, 0);
    }
  }
  if (mOnScrollListener != null) {
    mOnScrollListener.onScroll(view, firstVisibleItem, visibleItemCount, totalItemCount);
  }
}

代码示例来源:origin: stackoverflow.com

ImageView mView;

float lastScrollX;
float lastScrollY;

...

@Override
public void onClick(View v) {
  lastScrollX = mView.getScrollX();
  lastScrollY = mView.getScrollY();
  lastScrollY += 50.0;
  lastScrollX += 50.0;
  mView.setX(lastScrollX) 
  mView.setY(lastScrollY)
  mView.invalidate();
}

代码示例来源:origin: stackoverflow.com

public static float[] getPointerCoords(ImageView view, MotionEvent e)
{
  final int index = e.getActionIndex();
  final float[] coords = new float[] { e.getX(index), e.getY(index) };
  Matrix matrix = new Matrix();
  view.getImageMatrix().invert(matrix);
  matrix.postTranslate(view.getScrollX(), view.getScrollY());
  matrix.mapPoints(coords);
  return coords;
}

public boolean onTouch(View v, MotionEvent event)
{
  float[]     returnedXY  = getPointerCoords((ImageView) v, event);
  imageView.setLeft(returnedXY[0] + (imageView.getWidth() /2));
  imageView.setTop(returnedXY[1] + (imageView.getHeight() /2));
}

代码示例来源:origin: hiphonezhu/Android-Demos

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
{
  super.onMeasure(widthMeasureSpec, heightMeasureSpec);
  // 动态设置RecyclerView的高度
  ViewGroup.LayoutParams params = recyclerView.getLayoutParams();
  // StickyNavLayout高度 - Sticky View高度 - ImageView可见高度
  params.height = getMeasuredHeight() - tvSticky.getMeasuredHeight() - (mTopViewHeight - iv.getScrollY());
  recyclerView.setLayoutParams(params);
}

相关文章

ImageView类方法