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

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

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

ViewPropertyAnimator.setListener介绍

[英]Sets a listener for events in the underlying Animators that run the property animations.
[中]为运行属性动画的基础动画制作程序中的事件设置侦听器。

代码示例

代码示例来源:origin: commonsguy/cw-omnibus

@TargetApi(11)
private void translateWidgets(int deltaX, View... views) {
 for (final View v : views) {
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
   v.setLayerType(View.LAYER_TYPE_HARDWARE, null);
  }
  ViewPropertyAnimator.animate(v).translationXBy(deltaX)
            .setDuration(ANIM_DURATION)
            .setListener(new AnimatorListenerAdapter() {
             @Override
             public void onAnimationEnd(Animator animation) {
              if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
               v.setLayerType(View.LAYER_TYPE_NONE,
                       null);
              }
             }
            });
 }
}

代码示例来源:origin: code-mc/loadtoast

private void slideUp(int startDelay){
    mReAttached = false;

    ViewPropertyAnimator.animate(mView).setStartDelay(startDelay).alpha(0f)
        .translationY(-mView.getHeight() + mTranslationY)
        .setInterpolator(new AccelerateInterpolator())
        .setDuration(300)
        .setListener(new AnimatorListenerAdapter() {
          @Override
          public void onAnimationEnd(Animator animation) {
            if(!mReAttached){
              cleanup();
            }
          }
        })
        .start();

    mVisible = false;
  }
}

代码示例来源:origin: code-mc/loadtoast

private void showInternal(){
  mView.show();
  ViewHelper.setTranslationX(mView, (mParentView.getWidth() - mView.getWidth()) / 2);
  ViewHelper.setAlpha(mView, 0f);
  ViewHelper.setTranslationY(mView, -mView.getHeight() + mTranslationY);
  //mView.setVisibility(View.VISIBLE);
  ViewPropertyAnimator.animate(mView).alpha(1f).translationY(25 + mTranslationY)
      .setInterpolator(new DecelerateInterpolator())
      .setListener(null)
      .setDuration(300).setStartDelay(0).start();
  mVisible = true;
}

代码示例来源: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: 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

.translationX(moveTo)
.setDuration(animationTime)
.setListener(new AnimatorListenerAdapter() {
  @Override
  public void onAnimationEnd(Animator animation) {

代码示例来源: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

.alpha(alpha)
.setDuration(animationTime)
.setListener(new AnimatorListenerAdapter() {
  @Override
  public void onAnimationEnd(Animator animation) {

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

.alpha(0)
.setDuration(mAnimationTime)
.setListener(new AnimatorListenerAdapter() {
  @Override
  public void onAnimationEnd(Animator animation) {
.alpha(1)
.setDuration(mAnimationTime)
.setListener(null);

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

.alpha(1)
.setDuration(mAnimationTime)
.setListener(null);
.alpha(0)
.setDuration(mAnimationTime)
.setListener(new AnimatorListenerAdapter() {
  @Override
  public void onAnimationEnd(Animator animation) {
.alpha(1)
.setDuration(mAnimationTime)
.setListener(null);

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

.alpha(1)
.setDuration(mAnimationTime)
.setListener(null);

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

.translationX(thumbnailLeft)
.translationY(thumbnailTop)
.setListener(new Animator.AnimatorListener() {
 @Override public void onAnimationStart(Animator animation) {

相关文章