android.support.v7.widget.CardView.getTop()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(3.0k)|赞(0)|评价(0)|浏览(135)

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

CardView.getTop介绍

暂无

代码示例

代码示例来源:origin: NightscoutFoundation/xDrip

private void correctiveScrolling(int i, AtomicBoolean marker) {
  final float floaterY = floatingsnooze.getTop();
  if (marker.getAndSet(true)) return; // already processed
  int val = 0;
  int ii = 0;
  while (val > -1) {
    View v = recyclerView.getChildAt(ii);
    if (v != null) {
      val = recyclerView.getChildAdapterPosition(v);
      if (val == i) {
        final float lowest_point = v.getY() + (v.getHeight() * 2);
        //Log.d(TAG, "Requested Child at position : " + i + " / " + ii + " " + val + " v:" + lowest_point + " vs " + floaterY);
        if (lowest_point > floaterY) {
          // is obscured
          final float difference = lowest_point - floaterY;
          //  int scrollto = i+((int)difference)+1;
          Log.d(TAG, "Corrective Scrolling by: " + (int) difference);
          // TODO wrap with speed adjustment
          recyclerView.smoothScrollBy(0, (int) difference);
        }
        val = -1;
      }
    } else {
      val = -1;
    }
    ii++;
  }
}

代码示例来源:origin: jamorham/xDrip-plus

private void correctiveScrolling(int i, AtomicBoolean marker) {
  final float floaterY = floatingsnooze.getTop();
  if (marker.getAndSet(true)) return; // already processed
  int val = 0;
  int ii = 0;
  while (val > -1) {
    View v = recyclerView.getChildAt(ii);
    if (v != null) {
      val = recyclerView.getChildAdapterPosition(v);
      if (val == i) {
        final float lowest_point = v.getY() + (v.getHeight() * 2);
        //Log.d(TAG, "Requested Child at position : " + i + " / " + ii + " " + val + " v:" + lowest_point + " vs " + floaterY);
        if (lowest_point > floaterY) {
          // is obscured
          final float difference = lowest_point - floaterY;
          //  int scrollto = i+((int)difference)+1;
          Log.d(TAG, "Corrective Scrolling by: " + (int) difference);
          // TODO wrap with speed adjustment
          recyclerView.smoothScrollBy(0, (int) difference);
        }
        val = -1;
      }
    } else {
      val = -1;
    }
    ii++;
  }
}

代码示例来源:origin: unixzii/android-SpringAnimator

@Override
  public void onAnimationUpdate(AbsSpringAnimator animation) {
    ViewCompat.offsetTopAndBottom(mCardView, -mCardView.getTop() + (int) animation.getAnimatedValue());
  }
});

代码示例来源:origin: unixzii/android-SpringAnimator

@Override
public void onStartAnimation() {
  stopAnimators();
  if (!mOriLocationRecorded) {
    onResetView();
    return;
  }
  AbsSpringAnimator animator = createNewAnimator();
  animator.setStartValue(mCardView.getLeft());
  animator.setEndValue(mOriX);
  animator.addUpdateListener(new AbsSpringAnimator.AnimatorUpdateListener() {
    @Override
    public void onAnimationUpdate(AbsSpringAnimator animation) {
      ViewCompat.offsetLeftAndRight(mCardView, -mCardView.getLeft() + (int) animation.getAnimatedValue());
    }
  });
  animator.start();
  mXAnimator = animator;
  animator = createNewAnimator();
  animator.setStartValue(mCardView.getTop());
  animator.setEndValue(mOriY);
  animator.addUpdateListener(new AbsSpringAnimator.AnimatorUpdateListener() {
    @Override
    public void onAnimationUpdate(AbsSpringAnimator animation) {
      ViewCompat.offsetTopAndBottom(mCardView, -mCardView.getTop() + (int) animation.getAnimatedValue());
    }
  });
  animator.start();
  mYAnimator = animator;
}

相关文章