com.nineoldandroids.view.ViewPropertyAnimator.translationX()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(3.7k)|赞(0)|评价(0)|浏览(118)

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

ViewPropertyAnimator.translationX介绍

[英]This method will cause the View's translationX property to be animated to the specified value. Animations already running on the property will be canceled.
[中]此方法将使视图的translationX属性设置为指定值的动画。已在该属性上运行的动画将被取消。

代码示例

代码示例来源:origin: domoticz/domoticz-android

public void dismissCard(final View downView, final int position) {
  float viewWidth = downView.getMeasuredWidth();
  ++mDismissAnimationRefCount;
  animate(downView)
      .translationX(viewWidth)
      .alpha(0)
      .setDuration(mAnimationTime)
      .setListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
          performDismiss(downView, position);
        }
      });
}

代码示例来源:origin: DickyQie/android-shoppingcart

/**
 * @param view
 *            所要移动的视图
 * @param deltaX
 *            最终移动的距离
 */
public void generateRevealAnimate(final View view, float deltaX) {
  int moveTo = 0;
  moveTo = (int) deltaX;
  animate(view).translationX(moveTo).setDuration(10)
      .setListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
        }
      });
}

代码示例来源:origin: devinhu/androidone

.translationX(moveTo)
.setDuration(animationTime)
.setListener(new AnimatorListenerAdapter() {

代码示例来源:origin: grzegorznittner/chanu

/**
 * Slide out a view to the right or left of the list. After the animation has finished, the
 * view will be dismissed by calling {@link #performDismiss(android.view.View, android.view.View, int)}.
 *
 * @param view The view, that should be slided out.
 * @param childView The whole view of the list item.
 * @param position The item position of the item.
 * @param toRightSide Whether it should slide out to the right side.
 */
private void slideOutView(final View view, final View childView, final int position, boolean toRightSide) {
  // Only start new animation, if this view isn't already animated (too fast swiping bug)
  synchronized(mAnimationLock) {
    if(mAnimatedViews.contains(view)) {
      return;
    }
    ++mDismissAnimationRefCount;
    mAnimatedViews.add(view);
  }
  ViewPropertyAnimator.animate(view)
      .translationX(toRightSide ? mViewWidth : -mViewWidth)
      .alpha(0)
      .setDuration(mAnimationTime)
      .setListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
          performDismiss(view, childView, position);
        }
      });
}

代码示例来源:origin: devinhu/androidone

/**
 * Create choice animation
 *
 * @param view     affected view
 * @param position list position
 */
private void generateChoiceAnimate(final View view, final int position) {
  animate(view)
      .translationX(0)
      .setDuration(animationTime)
      .setListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
          swipeListView.resetScrolling();
          resetCell();
        }
      });
}

代码示例来源:origin: devinhu/androidone

.translationX(moveTo)
.alpha(alpha)
.setDuration(animationTime)

代码示例来源:origin: SMSTicket/sms-ticket

++mDismissAnimationRefCount;
animate(mDownView)
  .translationX(dismissRight ? mViewWidth : -mViewWidth)
  .alpha(0)
  .setDuration(mAnimationTime)
  .translationX(0)
  .alpha(1)
  .setDuration(mAnimationTime)

代码示例来源:origin: domoticz/domoticz-android

.translationX(0)
    .alpha(1)
    .setDuration(mAnimationTime)
++mDismissAnimationRefCount;
animate(mDownView)
    .translationX(dismissRight ? mViewWidth : -mViewWidth)
    .alpha(0)
    .setDuration(mAnimationTime)
    .translationX(0)
    .alpha(1)
    .setDuration(mAnimationTime)

代码示例来源:origin: grzegorznittner/chanu

.translationX(0)
.alpha(1)
.setDuration(mAnimationTime)

代码示例来源:origin: StannyBing/ZXUtils

.scaleX((float) thumbnailWidth / mViewPager.getWidth())
.scaleY((float) thumbnailHeight / mViewPager.getHeight())
.translationX(thumbnailLeft)
.translationY(thumbnailTop)
.setListener(new Animator.AnimatorListener() {

代码示例来源:origin: StannyBing/ZXUtils

.scaleX(1)
.scaleY(1)
.translationX(0)
.translationY(0)
.setInterpolator(new DecelerateInterpolator());

相关文章