android.view.animation.Animation.setRepeatCount()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(202)

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

Animation.setRepeatCount介绍

暂无

代码示例

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

Animation rotation = AnimationUtils.loadAnimation(this, R.anim.rotation);
rotation.setRepeatCount(Animation.INFINITE);
myView.startAnimation(rotation);

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

Animation rotation = AnimationUtils.loadAnimation(this, R.anim.clockwise_rotation);
rotation.setRepeatCount(Animation.INFINITE);
myView.startAnimation(rotation);

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

public void refresh() {
  /* Attach a rotating ImageView to the refresh item as an ActionView */
  LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  ImageView iv = (ImageView) inflater.inflate(R.layout.refresh_action_view, null);
  Animation rotation = AnimationUtils.loadAnimation(getActivity(), R.anim.clockwise_refresh);
  rotation.setRepeatCount(Animation.INFINITE);
  iv.startAnimation(rotation);
  refreshItem.setActionView(iv);
  //TODO trigger loading
}

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

Animation a = new RotateAnimation(0.0f, 360.0f,
       Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
       0.5f);
   a.setRepeatCount(-1);
   a.setDuration(1000);

代码示例来源:origin: Aspsine/SwipeToLoadLayout

private void setupAnimations() {
  mAnimation = new Animation() {
    @Override
    public void applyTransformation(float interpolatedTime, Transformation t) {
      setRotate(interpolatedTime);
    }
  };
  mAnimation.setRepeatCount(Animation.INFINITE);
  mAnimation.setRepeatMode(Animation.RESTART);
  mAnimation.setInterpolator(LINEAR_INTERPOLATOR);
  mAnimation.setDuration(ANIMATION_DURATION);
}

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

public void onCreate(Bundle savedInstanceState) {
  final Animation animation = new AlphaAnimation(1, 0); // Change alpha from fully visible to invisible
  animation.setDuration(500); // duration - half a second
  animation.setInterpolator(new LinearInterpolator()); // do not alter animation rate
  animation.setRepeatCount(Animation.INFINITE); // Repeat animation infinitely
  animation.setRepeatMode(Animation.REVERSE); // Reverse animation at the end so the button will fade back in
  final Button btn = (Button) findViewById(R.id.your_btn);
  btn.startAnimation(animation);
  btn.setOnClickListener(new OnClickListener() {
    @Override
    public void onClick(final View view) {
      view.clearAnimation();
    }
  });
}

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

TextView myText = (TextView) findViewById(R.id.myText );

Animation anim = new AlphaAnimation(0.0f, 1.0f);
anim.setDuration(50); //You can manage the blinking time with this parameter
anim.setStartOffset(20);
anim.setRepeatMode(Animation.REVERSE);
anim.setRepeatCount(Animation.INFINITE);
myText.startAnimation(anim);

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

TextView myText = (TextView) findViewById(R.id.myText );

Animation anim = new AlphaAnimation(0.0f, 1.0f);
anim.setDuration(50); //You can manage the time of the blink with this parameter
anim.setStartOffset(20);
anim.setRepeatMode(Animation.REVERSE);
anim.setRepeatCount(Animation.INFINITE);
myText.startAnimation(anim);

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

// Locate view
 ImageView diskView = (ImageView) findViewById(R.id.imageView3);
 // Create an animation instance
 Animation an = new RotateAnimation(0.0f, 360.0f, pivotX, pivotY);
 // Set the animation's parameters
 an.setDuration(10000);               // duration in ms
 an.setRepeatCount(0);                // -1 = infinite repeated
 an.setRepeatMode(Animation.REVERSE); // reverses each repeat
 an.setFillAfter(true);               // keep rotation after animation
 // Aply animation to image view
 diskView.setAnimation(an);

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

animation.setRepeatCount(Animation.INFINITE);
animation.setRepeatMode(Animation.RESTART);
animation.setInterpolator(LINEAR_INTERPOLATOR);

代码示例来源:origin: Bearded-Hen/Android-Bootstrap

/**
 * Starts a Flashing Animation on the AwesomeTextView
 *
 * @param forever whether the animation should be infinite or play once
 * @param speed   how fast the item should flash
 */
public void startFlashing(boolean forever, AnimationSpeed speed) {
  Animation fadeIn = new AlphaAnimation(0, 1);
  //set up extra variables
  fadeIn.setDuration(50);
  fadeIn.setRepeatMode(Animation.REVERSE);
  //default repeat count is 0, however if user wants, set it up to be infinite
  fadeIn.setRepeatCount(0);
  if (forever) {
    fadeIn.setRepeatCount(Animation.INFINITE);
  }
  fadeIn.setStartOffset(speed.getFlashDuration());
  startAnimation(fadeIn);
}

代码示例来源:origin: smuyyh/BookReader

animation.setRepeatCount(Animation.INFINITE);
animation.setRepeatMode(Animation.RESTART);
animation.setInterpolator(LINEAR_INTERPOLATOR);

代码示例来源:origin: android-cjj/Android-MaterialRefreshLayout

animation.setRepeatCount(Animation.INFINITE);
animation.setRepeatMode(Animation.RESTART);
animation.setInterpolator(LINEAR_INTERPOLATOR);

代码示例来源:origin: Bearded-Hen/Android-Bootstrap

/**
 * Starts a rotating animation on the AwesomeTextView
 *
 * @param clockwise true for clockwise, false for anti clockwise spinning
 * @param speed     how fast the item should rotate
 */
public void startRotate(boolean clockwise, AnimationSpeed speed) {
  Animation rotate;
  //set up the rotation animation
  if (clockwise) {
    rotate = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
  }
  else {
    rotate = new RotateAnimation(360, 0, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
  }
  //set up some extra variables
  rotate.setRepeatCount(Animation.INFINITE);
  rotate.setInterpolator(new LinearInterpolator());
  rotate.setStartOffset(0);
  rotate.setRepeatMode(Animation.RESTART);
  rotate.setDuration(speed.getRotateDuration());
  startAnimation(rotate);
}

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

mAnimation.setRepeatCount(Animation.INFINITE);
mAnimation.setRepeatMode(Animation.REVERSE);
mAnimation.setInterpolator(ACCELERATE_DECELERATE_INTERPOLATOR);

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

mAnimation.setRepeatCount(Animation.INFINITE);
mAnimation.setRepeatMode(Animation.RESTART);
mAnimation.setInterpolator(LINEAR_INTERPOLATOR);

代码示例来源:origin: jaydenxiao2016/AndroidFire

animation.setFillAfter(true);
animation.setDuration(2000);
animation.setRepeatCount(ValueAnimator.INFINITE);
animation.setRepeatMode(ValueAnimator.INFINITE);
animation1.setFillAfter(true);
animation1.setDuration(2000);
animation1.setRepeatCount(ValueAnimator.INFINITE);
animation1.setRepeatMode(ValueAnimator.INFINITE);
ivBatMan.setAnimation(animation);

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

//How you start
Animation rotation = AnimationUtils.loadAnimation(this, R.anim.rotate);
     rotation.setRepeatCount(Animation.INFINITE);
iv.startAnimation(rotation);

//You do your stuff while it spins
...

//You tell it not to repeat again
rotation.setRepeatCount(0);

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

/* Get ImageView Object */
ImageView iv = (ImageView) view.findViewById(R.id.refresh_action_view);

/* Create Animation */
Animation rotation = AnimationUtils.loadAnimation(context, R.anim.refresh_button_anim);
rotation.setRepeatCount(Animation.INFINITE);

/* start Animation */
iv.startAnimation(rotation);

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

Animation mAnimation = new TranslateAnimation(START_POS_X, END_POS_X, 
        START_POS_Y, END_POS_Y);
mAnimation.setDuration(TICKER_DURATION); 
mAnimation.setRepeatMode(Animation.RESTART);
mAnimation.setRepeatCount(Animation.INFINITE);

相关文章

微信公众号

最新文章

更多