android.widget.TextView.animate()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(8.0k)|赞(0)|评价(0)|浏览(139)

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

TextView.animate介绍

暂无

代码示例

代码示例来源: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: prolificinteractive/material-calendarview

@Override
 public void onAnimationEnd(Animator animator) {
  title.setText(newTitle);
  doTranslation(title, translation);
  final ViewPropertyAnimator viewPropertyAnimator = title.animate();
  if (orientation == MaterialCalendarView.HORIZONTAL) {
   viewPropertyAnimator.translationX(0);
  } else {
   viewPropertyAnimator.translationY(0);
  }
  viewPropertyAnimator
    .alpha(1)
    .setDuration(animDuration)
    .setInterpolator(interpolator)
    .setListener(new AnimatorListener())
    .start();
 }
}).start();

代码示例来源:origin: qiujuer/Genius-Android

@Override
public void onOpeningComplete() {
  mNumber.setVisibility(View.VISIBLE);
  ViewPropertyAnimator animator = mNumber.animate();
  animator.alpha(1f);
  animator.setDuration(100);
  animator.start();
  /*
  ViewCompat.animate(mNumber)
      .alpha(1f)
      .setDuration(100)
      .start();
  */
  if (getParent() instanceof BalloonMarkerDrawable.MarkerAnimationListener) {
    ((BalloonMarkerDrawable.MarkerAnimationListener) getParent()).onOpeningComplete();
  }
}

代码示例来源:origin: qiujuer/Genius-Android

@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public void animateClose() {
  mBalloonMarkerDrawable.stop();
  ViewPropertyAnimator animator = mNumber.animate();
  animator.alpha(0f);
  animator.setDuration(100);
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
    animator.withEndAction(new Runnable() {
      @Override
      public void run() {
        //We use INVISIBLE instead of GONE to avoid a requestLayout
        mNumber.setVisibility(View.INVISIBLE);
        mBalloonMarkerDrawable.animateToNormal();
      }
    });
  } else {
    animator.setListener(new AnimatorListener() {
      @Override
      public void onAnimationEnd(Animator animation) {
        //We use INVISIBLE instead of GONE to avoid a requestLayout
        mNumber.setVisibility(View.INVISIBLE);
        mBalloonMarkerDrawable.animateToNormal();
      }
    });
  }
  animator.start();
}

代码示例来源: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: prolificinteractive/material-calendarview

private void doChange(final long now, final CalendarDay currentMonth, boolean animate) {
 title.animate().cancel();
 doTranslation(title, 0);
 } else {
  final int translation = translate * (previousMonth.isBefore(currentMonth) ? 1 : -1);
  final ViewPropertyAnimator viewPropertyAnimator = title.animate();

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

nextTextView.setText(String.format(Locale.getDefault(), "%d", oldValue-1));
currentTextView.animate().translationY(-getHeight()).setDuration(ANIMATION_DURATION).start();
nextTextView.setTranslationY(nextTextView.getHeight());
nextTextView.animate().translationY(0).setDuration(ANIMATION_DURATION).setListener(new Animator.AnimatorListener() {
  @Override
  public void onAnimationStart(Animator animation) {}
nextTextView.setText(String.format(Locale.getDefault(), "%d", oldValue+1));
currentTextView.animate().translationY(getHeight()).setDuration(ANIMATION_DURATION).start();
nextTextView.setTranslationY(-nextTextView.getHeight());
nextTextView.animate().translationY(0).setDuration(ANIMATION_DURATION).setListener(new Animator.AnimatorListener() {
  @Override
  public void onAnimationStart(Animator animation) {}

代码示例来源:origin: aurelhubert/ahbottomnavigation

notification.setText("");
if (animate) {
  notification.animate()
      .scaleX(0)
      .scaleY(0)
  notification.setScaleX(0);
  notification.setScaleY(0);
  notification.animate()
      .scaleX(1)
      .scaleY(1)

代码示例来源:origin: fython/MaterialStepperView

mPointNumber.animate().alpha(0f).setDuration(mAnimationDuration).start();
} else if (state != STATE_DONE && mState == STATE_DONE) {
  mDoneIconView.animate().alpha(0f).setDuration(mAnimationDuration).start();
  mPointNumber.animate().alpha(1f).setDuration(mAnimationDuration).start();
} else {
  mDoneIconView.setAlpha(state == STATE_DONE ? 1f : 0f);

代码示例来源:origin: xinghongfei/LookLook

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(500)
        .setDuration(900)
        .setInterpolator(AnimUtils.getFastOutSlowInInterpolator(this)).start();
  }
  View amv = toolbar.getChildAt(1);
  if (amv != null & amv instanceof ActionMenuView) {
    ActionMenuView actions = (ActionMenuView) amv;
    popAnim(actions.getChildAt(0), 500, 200); // filter
    popAnim(actions.getChildAt(1), 700, 200); // overflow
  }
}

代码示例来源:origin: com.albedinsky.android/ui-widget-input

/**
   * Starts fade in animation for the note text view.
   */
  void startFadeInAnimation() {
    mNoteView.animate()
        .setDuration(mNoteTextChangeDuration)
        .setListener(null)
        .alpha(1)
        .start();
  }
}

代码示例来源:origin: com.albedinsky.android/ui

/**
   * Starts fade in animation for the note text view.
   */
  void startFadeInAnimation() {
    mNoteView.animate()
        .setDuration(mNoteTextChangeDuration)
        .setListener(null)
        .alpha(1)
        .start();
  }
}

代码示例来源:origin: L4Digital/FastScroll

private void showBubble() {
  if (!isViewVisible(bubbleView)) {
    bubbleView.setVisibility(VISIBLE);
    bubbleAnimator = bubbleView.animate().alpha(1f)
        .setDuration(BUBBLE_ANIM_DURATION)
        .setListener(new AnimatorListenerAdapter() {
          // adapter required for new alpha value to stick
        });
  }
}

代码示例来源:origin: derry/delion

private void setViewText(TextView view, CharSequence text, boolean animate) {
    if (view.getText().toString().equals(text)) return;
    view.animate().cancel();
    if (animate) {
      view.setAlpha(0.0f);
      view.setText(text);
      view.animate().alpha(1.f).setDuration(mAnimationDuration).setListener(null);
    } else {
      view.setText(text);
    }
  }
}

代码示例来源:origin: Doist/RecyclerViewExtensions

@Override
  public void onClick(View itemView) {
    textView.animate().rotationBy(360).setDuration(500).start();
  }
}

代码示例来源:origin: akshay2211/PixImagePicker

private void showBubble() {
  if (!Utility.isViewVisible(mBubbleView)) {
    mBubbleView.setVisibility(View.VISIBLE);
    mBubbleView.setAlpha(0f);
    mBubbleAnimator = mBubbleView.animate().alpha(1f)
        .setDuration(sBubbleAnimDuration)
        .setListener(new AnimatorListenerAdapter() {
          // adapter required for new alpha value to stick
        });
    mBubbleAnimator.start();
  }
}

代码示例来源:origin: AlphaBoom/ClassifyView

@Override
public void onAnimationEnd(Animator animation) {
  binding.iReaderFolderCheckBox.setScaleX(1f);
  binding.iReaderFolderCheckBox.setScaleY(1f);
  binding.iReaderFolderCheckBox.animate().setListener(null);
}

代码示例来源:origin: AlphaBoom/ClassifyView

@Override
public void onAnimationCancel(Animator animation) {
  binding.iReaderFolderCheckBox.setScaleX(1f);
  binding.iReaderFolderCheckBox.setScaleY(1f);
  binding.iReaderFolderCheckBox.animate().setListener(null);
}

代码示例来源:origin: the-pig-of-jungle/SmartShow

@Override
  public void animateContentOut(int delay, int duration) {
    mMessageView.setAlpha(1f);
    mMessageView.animate().alpha(0f).setDuration(duration)
        .setStartDelay(delay).start();

    if (mActionView.getVisibility() == VISIBLE) {
      mActionView.setAlpha(1f);
      mActionView.animate().alpha(0f).setDuration(duration)
          .setStartDelay(delay).start();
    }
  }
}

代码示例来源:origin: the-pig-of-jungle/SmartShow

@Override
public void animateContentIn(int delay, int duration) {
  mMessageView.setAlpha(0f);
  mMessageView.animate().alpha(1f).setDuration(duration)
      .setStartDelay(delay).start();
  if (mActionView.getVisibility() == VISIBLE) {
    mActionView.setAlpha(0f);
    mActionView.animate().alpha(1f).setDuration(duration)
        .setStartDelay(delay).start();
  }
}

相关文章

微信公众号

最新文章

更多

TextView类方法