android.view.ViewPropertyAnimator.setDuration()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(138)

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

ViewPropertyAnimator.setDuration介绍

暂无

代码示例

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

@Override
public ViewPropertyAnimator setDuration(long duration) {
  android.view.ViewPropertyAnimator n = mNative.get();
  if (n != null) {
    n.setDuration(duration);
  }
  return this;
}

代码示例来源:origin: scwang90/SmartRefreshLayout

@Override
public void onStartAnimator(@NonNull RefreshLayout refreshLayout, int height, int maxDragHeight) {
  final View progressView = mProgressView;
  if (progressView.getVisibility() != VISIBLE) {
    progressView.setVisibility(VISIBLE);
    Drawable drawable = mProgressView.getDrawable();
    if (drawable instanceof Animatable) {
      ((Animatable) drawable).start();
    } else {
      progressView.animate().rotation(36000).setDuration(100000);
    }
  }
}

代码示例来源:origin: seven332/EhViewer

private void showProgress(boolean animation) {
  if (null != mProgress && View.VISIBLE != mProgress.getVisibility()) {
    if (animation) {
      mProgress.setAlpha(0.0f);
      mProgress.setVisibility(View.VISIBLE);
      mProgress.animate().alpha(1.0f).setDuration(500).start();
    } else {
      mProgress.setAlpha(1.0f);
      mProgress.setVisibility(View.VISIBLE);
    }
  }
}

代码示例来源:origin: scwang90/SmartRefreshLayout

@Override
public void onReleased(@NonNull final RefreshLayout layout, int height, int maxDragHeight) {
  final View imageView = mImageView;
  final View dropView = mWaterDropView;
  mProgressDrawable.start();
  imageView.setVisibility(GONE);
  mWaterDropView.createAnimator().start();//开始回弹
  dropView.animate().setDuration(150).alpha(0).setListener(new AnimatorListenerAdapter() {
    public void onAnimationEnd(Animator animation) {
      dropView.setVisibility(GONE);
      dropView.setAlpha(1);
    }
  });
}

代码示例来源:origin: Yalantis/uCrop

@Override
public void onLoadComplete() {
  mUCropView.animate().alpha(1).setDuration(300).setInterpolator(new AccelerateInterpolator());
  mBlockingView.setClickable(false);
  mShowLoader = false;
  supportInvalidateOptionsMenu();
}

代码示例来源:origin: Yalantis/uCrop

@Override
public void onLoadComplete() {
  mUCropView.animate().alpha(1).setDuration(300).setInterpolator(new AccelerateInterpolator());
  mBlockingView.setClickable(false);
  callback.loadingProgress(false);
}

代码示例来源:origin: scwang90/SmartRefreshLayout

@Override
  public boolean onTwoLevel(@NonNull RefreshLayout refreshLayout) {
    Toast.makeText(getContext(),"触发二楼事件",Toast.LENGTH_SHORT).show();
    root.findViewById(R.id.secondfloor_content).animate().alpha(1).setDuration(2000);
    refreshLayout.getLayout().postDelayed(new Runnable() {
      @Override
      public void run() {
        header.finishTwoLevel();
        root.findViewById(R.id.secondfloor_content).animate().alpha(0).setDuration(1000);
      }
    },5000);
    return true;//true 将会展开二楼状态 false 关闭刷新
  }
});

代码示例来源:origin: frogermcs/InstaMaterial

private void animateUserProfileHeader() {
      vUserProfileRoot.setTranslationY(-vUserProfileRoot.getHeight());
      ivUserProfilePhoto.setTranslationY(-ivUserProfilePhoto.getHeight());
      vUserDetails.setTranslationY(-vUserDetails.getHeight());
      vUserStats.setAlpha(0);

      vUserProfileRoot.animate().translationY(0).setDuration(300).setInterpolator(INTERPOLATOR);
      ivUserProfilePhoto.animate().translationY(0).setDuration(300).setStartDelay(100).setInterpolator(INTERPOLATOR);
      vUserDetails.animate().translationY(0).setDuration(300).setStartDelay(200).setInterpolator(INTERPOLATOR);
      vUserStats.animate().alpha(1).setDuration(200).setStartDelay(400).setInterpolator(INTERPOLATOR).start();
  }
}

代码示例来源:origin: scwang90/SmartRefreshLayout

@Override
public int onFinish(@NonNull RefreshLayout refreshLayout, boolean success) {
  final View progressView = mProgressView;
  Drawable drawable = mProgressView.getDrawable();
  if (drawable instanceof Animatable) {
    if (((Animatable) drawable).isRunning()) {
      ((Animatable) drawable).stop();
    }
  } else {
    progressView.animate().rotation(0).setDuration(0);
  }
  progressView.setVisibility(GONE);
  return mFinishDuration;//延迟500毫秒之后再弹回
}

代码示例来源:origin: arimorty/floatingsearchview

private void animateItem(View view) {
    view.setTranslationY(Util.getScreenHeight((Activity) view.getContext()));
    view.animate()
        .translationY(0)
        .setInterpolator(new DecelerateInterpolator(3.f))
        .setDuration(700)
        .start();
  }
}

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

@Override
 public void run() {
  if (fadingOut) {
   fadee.animate().alpha(0).setDuration(PERIOD);
   fadee.setText(R.string.fading_out);
  }
  else {
   fadee.animate().alpha(1).setDuration(PERIOD);
   fadee.setText(R.string.coming_back);
  }
  
  fadingOut=!fadingOut;
  
  fadee.postDelayed(this, PERIOD);
 }
}

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

private void translateWidgets(int deltaX, View... views) {
 for (final View v : views) {
  v.setLayerType(View.LAYER_TYPE_HARDWARE, null);
  v.animate().translationXBy(deltaX).setDuration(ANIM_DURATION)
   .setListener(new AnimatorListenerAdapter() {
    @Override
    public void onAnimationEnd(Animator animation) {
     v.setLayerType(View.LAYER_TYPE_NONE, null);
    }
   });
 }
}

代码示例来源:origin: frogermcs/InstaMaterial

private void startIntroAnimation() {
  vUpperPanel.animate().translationY(0).setDuration(400).setInterpolator(DECELERATE_INTERPOLATOR);
  vLowerPanel.animate().translationY(0).setDuration(400).setInterpolator(DECELERATE_INTERPOLATOR).start();
}

代码示例来源:origin: frogermcs/InstaMaterial

private void animateContent() {
  commentsAdapter.updateItems();
  llAddComment.animate().translationY(0)
      .setInterpolator(new DecelerateInterpolator())
      .setDuration(200)
      .start();
}

代码示例来源:origin: seven332/EhViewer

private void hideActionFab() {
  if (null != mFabLayout && STATE_NORMAL == mState && mShowActionFab) {
    mShowActionFab = false;
    View fab = mFabLayout.getPrimaryFab();
    fab.animate().scaleX(0.0f).scaleY(0.0f).setListener(mActionFabAnimatorListener)
        .setDuration(ANIMATE_TIME).setStartDelay(0L)
        .setInterpolator(AnimationUtils.SLOW_FAST_INTERPOLATOR).start();
  }
}

代码示例来源:origin: frogermcs/InstaMaterial

private void startContentAnimation() {
  fabCreate.animate()
      .translationY(0)
      .setInterpolator(new OvershootInterpolator(1.f))
      .setStartDelay(300)
      .setDuration(ANIM_DURATION_FAB)
      .start();
  feedAdapter.updateItems(true);
}

代码示例来源:origin: frogermcs/InstaMaterial

@Override
public void onSuccess() {
  ivPhoto.animate()
      .scaleX(1.f).scaleY(1.f)
      .setInterpolator(new OvershootInterpolator())
      .setDuration(400)
      .setStartDelay(200)
      .start();
}

代码示例来源:origin: frogermcs/InstaMaterial

private void animateUserProfileOptions() {
  tlUserProfileTabs.setTranslationY(-tlUserProfileTabs.getHeight());
  tlUserProfileTabs.animate().translationY(0).setDuration(300).setStartDelay(USER_OPTIONS_ANIMATION_DELAY).setInterpolator(INTERPOLATOR);
}

代码示例来源:origin: nickbutcher/plaid

private void animateToolbar() {
  // this is gross but toolbar doesn't expose it's children to animate them :(
  View t = toolbar.getChildAt(0);
  if (t != null && t instanceof TextView) {
    TextView title = (TextView) t;
    // fade in and space out the title.  Animating the letterSpacing performs horribly so
    // fake it by setting the desired letterSpacing then animating the scaleX ¯\_(ツ)_/¯
    title.setAlpha(0f);
    title.setScaleX(0.8f);
    title.animate()
        .alpha(1f)
        .scaleX(1f)
        .setStartDelay(300)
        .setDuration(900)
        .setInterpolator(AnimUtils.getFastOutSlowInInterpolator(this));
  }
}

代码示例来源:origin: nickbutcher/plaid

private void showFab() {
  fab.setAlpha(0f);
  fab.setScaleX(0f);
  fab.setScaleY(0f);
  fab.setTranslationY(fab.getHeight() / 2);
  fab.animate()
      .alpha(1f)
      .scaleX(1f)
      .scaleY(1f)
      .translationY(0f)
      .setDuration(300L)
      .setInterpolator(AnimUtils.getLinearOutSlowInInterpolator(this))
      .start();
}

相关文章