本文整理汇总了Java中android.view.animation.AnimationSet.setFillAfter方法的典型用法代码示例。如果您正苦于以下问题:Java AnimationSet.setFillAfter方法的具体用法?Java AnimationSet.setFillAfter怎么用?Java AnimationSet.setFillAfter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.animation.AnimationSet
的用法示例。
在下文中一共展示了AnimationSet.setFillAfter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: open
import android.view.animation.AnimationSet; //导入方法依赖的package包/类
public void open() {
AnimationSet animationSet = new AnimationSet(true);
animationSet.setDuration(duration);
animationSet.setAnimationListener(this);
animationSet.setFillAfter(true);
RotateAnimation rotateAnimation = new RotateAnimation(270, 360,
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
animationSet.addAnimation(rotateAnimation);
Animation scaleAnimation = new ScaleAnimation(1.25f, 1f, 1.25f, 1f,
ScaleAnimation.RELATIVE_TO_SELF, 0.5f, ScaleAnimation.RELATIVE_TO_SELF, 0.5f);
animationSet.addAnimation(scaleAnimation);
imageView.startAnimation(animationSet);
AnimatorSet animatorSet = new AnimatorSet();
ObjectAnimator animator1 = ObjectAnimator.ofInt(mLinearLayout, "width", 0, mLinearLayoutWidth);
ObjectAnimator animator2 = ObjectAnimator.ofInt(mLinearLayout, "paddingLeft", 0, savePaddingLeft);
ObjectAnimator animator3 = ObjectAnimator.ofInt(mLinearLayout, "paddingRight", 0, savePaddingRight);
ObjectAnimator animator4 = ObjectAnimator.ofInt(mLinearLayout, "marginLeft", 0, saveMarginLeft);
ObjectAnimator animator5 = ObjectAnimator.ofInt(mLinearLayout, "marginRight", 0, saveMarginRight);
animatorSet.playTogether(animator1, animator2, animator3, animator4, animator5);
animatorSet.setDuration(duration).start();
}
示例2: display
import android.view.animation.AnimationSet; //导入方法依赖的package包/类
public void display(float x) {
this.startPositionX = x;
this.lastPositionX = x;
recordButtonFab.setVisibility(View.VISIBLE);
float translation = ViewCompat.getLayoutDirection(recordButtonFab) ==
ViewCompat.LAYOUT_DIRECTION_LTR ? -.25f : .25f;
AnimationSet animation = new AnimationSet(true);
animation.addAnimation(new TranslateAnimation(Animation.RELATIVE_TO_SELF, translation,
Animation.RELATIVE_TO_SELF, translation,
Animation.RELATIVE_TO_SELF, -.25f,
Animation.RELATIVE_TO_SELF, -.25f));
animation.addAnimation(new ScaleAnimation(.5f, 1f, .5f, 1f,
Animation.RELATIVE_TO_SELF, .5f,
Animation.RELATIVE_TO_SELF, .5f));
animation.setFillBefore(true);
animation.setFillAfter(true);
animation.setDuration(ANIMATION_DURATION);
animation.setInterpolator(new OvershootInterpolator());
recordButtonFab.startAnimation(animation);
}
示例3: createShrinkAnimation
import android.view.animation.AnimationSet; //导入方法依赖的package包/类
private static Animation createShrinkAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta,
long startOffset, long duration, Interpolator interpolator) {
AnimationSet animationSet = new AnimationSet(false);
animationSet.setFillAfter(true);
final long preDuration = duration / 2;
Animation rotateAnimation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f,
Animation.RELATIVE_TO_SELF, 0.5f);
rotateAnimation.setStartOffset(startOffset);
rotateAnimation.setDuration(preDuration);
rotateAnimation.setInterpolator(new LinearInterpolator());
rotateAnimation.setFillAfter(true);
animationSet.addAnimation(rotateAnimation);
Animation translateAnimation = new RotateAndTranslateAnimation(0, toXDelta, 0, toYDelta, 360, 720);
translateAnimation.setStartOffset(startOffset + preDuration);
translateAnimation.setDuration(duration - preDuration);
translateAnimation.setInterpolator(interpolator);
translateAnimation.setFillAfter(true);
animationSet.addAnimation(translateAnimation);
return animationSet;
}
示例4: startAlphaRevealAnimation
import android.view.animation.AnimationSet; //导入方法依赖的package包/类
/**
* For the Activity Circle Icon and text
*/
public static AnimationSet startAlphaRevealAnimation(final View VIEW) {
final int ANIMATION_DURATION = 1000;
final Animation mShowViewAnimation = new AlphaAnimation(0f, 1f);
mShowViewAnimation.setDuration(ANIMATION_DURATION);
AnimationSet mAnimations = new AnimationSet(true);
mAnimations.setInterpolator(new AccelerateDecelerateInterpolator());
mAnimations.addAnimation(mShowViewAnimation);
mAnimations.setFillAfter(true);
if(VIEW != null)
VIEW.startAnimation(mAnimations);
return mAnimations;
}
示例5: startAlphaHideAnimation
import android.view.animation.AnimationSet; //导入方法依赖的package包/类
public static AnimationSet startAlphaHideAnimation(final View VIEW) {
final int ANIMATION_DURATION = 350;
final Animation mHideViewAnimation = new AlphaAnimation(1f, 0f);
AnimationSet mAnimations = new AnimationSet(true);
mAnimations.setDuration(ANIMATION_DURATION);
mAnimations.setInterpolator(new AccelerateDecelerateInterpolator());
mAnimations.addAnimation(mHideViewAnimation);
mAnimations.setFillAfter(true);
if(VIEW != null)
VIEW.startAnimation(mAnimations);
return mAnimations;
}
示例6: setSwipePosition
import android.view.animation.AnimationSet; //导入方法依赖的package包/类
/**
* Sets the horizontal position and translucency of the view being swiped.
*/
@SuppressLint("NewApi")
private void setSwipePosition(View view, float deltaX) {
float fraction = Math.abs(deltaX) / view.getWidth();
if (isRuntimePostGingerbread()) {
view.setTranslationX(deltaX);
view.setAlpha(1 - fraction);
} else {
// Hello, Gingerbread!
TranslateAnimation swipeAnim = new TranslateAnimation(deltaX, deltaX, 0, 0);
mCurrentX = deltaX;
mCurrentAlpha = (1 - fraction);
AlphaAnimation alphaAnim = new AlphaAnimation(mCurrentAlpha, mCurrentAlpha);
AnimationSet set = new AnimationSet(true);
set.addAnimation(swipeAnim);
set.addAnimation(alphaAnim);
set.setFillAfter(true);
set.setFillEnabled(true);
view.startAnimation(set);
}
}
示例7: animateUp
import android.view.animation.AnimationSet; //导入方法依赖的package包/类
/**
* BottomSheet升起动画
*/
private void animateUp() {
if (mContentView == null) {
return;
}
TranslateAnimation translate = new TranslateAnimation(
Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0f,
Animation.RELATIVE_TO_SELF, 1f, Animation.RELATIVE_TO_SELF, 0f
);
AlphaAnimation alpha = new AlphaAnimation(0, 1);
AnimationSet set = new AnimationSet(true);
set.addAnimation(translate);
set.addAnimation(alpha);
set.setInterpolator(new DecelerateInterpolator());
set.setDuration(mAnimationDuration);
set.setFillAfter(true);
mContentView.startAnimation(set);
}
示例8: createShrinkAnimation
import android.view.animation.AnimationSet; //导入方法依赖的package包/类
private static Animation createShrinkAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta,
long startOffset, long duration, Interpolator interpolator) {
AnimationSet animationSet = new AnimationSet(false);
animationSet.setFillAfter(true);
final long preDuration = duration / 2;
Animation rotateAnimation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f,
Animation.RELATIVE_TO_SELF, 0.5f);
rotateAnimation.setStartOffset(startOffset);
rotateAnimation.setDuration(preDuration);
rotateAnimation.setInterpolator(new LinearInterpolator());
rotateAnimation.setFillAfter(true);
animationSet.addAnimation(rotateAnimation);
Animation translateAnimation = new RotateAndTranslateAnimation(0, toXDelta, 0, toYDelta, 360, 720);
translateAnimation.setStartOffset(startOffset + preDuration);
translateAnimation.setDuration(duration - preDuration);
translateAnimation.setInterpolator(interpolator);
translateAnimation.setFillAfter(true);
animationSet.addAnimation(translateAnimation);
return animationSet;
}
示例9: shakeAnimation
import android.view.animation.AnimationSet; //导入方法依赖的package包/类
public static Animation shakeAnimation(int X) {
AnimationSet set = new AnimationSet(true);
Animation anim1 = getTranslateAnimation(0, -200, 0, 0, 100);
anim1.setStartOffset(100);
set.addAnimation(anim1);
Animation anim2 = getTranslateAnimation(-200, 400, 0, 0, 200);
anim2.setStartOffset(300);
set.addAnimation(anim2);
Animation anim3 = getTranslateAnimation(400, -200, 0, 0, 200);
anim3.setStartOffset(500);
set.addAnimation(anim3);
Animation anim4 = getTranslateAnimation(-200, 0, 0, 0, 100);
anim4.setStartOffset(600);
set.addAnimation(anim4);
set.setFillAfter(true);
set.setDuration(640);
return set;
}
示例10: createItemDisapperAnimation
import android.view.animation.AnimationSet; //导入方法依赖的package包/类
private static Animation createItemDisapperAnimation(final long duration, final boolean isClicked) {
AnimationSet animationSet = new AnimationSet(true);
animationSet.addAnimation(new ScaleAnimation(1.0f, isClicked ? 2.0f : 0.0f, 1.0f, isClicked ? 2.0f : 0.0f,
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f));
animationSet.addAnimation(new AlphaAnimation(1.0f, 0.0f));
animationSet.setDuration(duration);
animationSet.setInterpolator(new DecelerateInterpolator());
animationSet.setFillAfter(true);
return animationSet;
}
示例11: slideFadeXIn
import android.view.animation.AnimationSet; //导入方法依赖的package包/类
/**
* 位移+淡入 向右
* @param view 动画作用的视图
* @param durationMillis 动画持续的时间
* @param delayMillis 经过多少毫秒播放动画
*/
public static void slideFadeXIn(View view, long durationMillis, long delayMillis, float d4X) {
TranslateAnimation animation1 = new TranslateAnimation(rela2, d4X, rela2, 0, rela2, 0, rela2, 0);
AlphaAnimation animation2 = new AlphaAnimation(0, 1);
AnimationSet animation = new AnimationSet(false);
animation.addAnimation(animation1);
animation.addAnimation(animation2);
animation.setFillAfter(true); //设置停留在动画后
baseIn(view, animation, durationMillis, delayMillis);
}
示例12: createItemDisapperAnimation
import android.view.animation.AnimationSet; //导入方法依赖的package包/类
private static Animation createItemDisapperAnimation(final long duration, final boolean isClicked) {
AnimationSet animationSet = new AnimationSet(true);
animationSet.addAnimation(new ScaleAnimation(1.0f, isClicked ? 2.0f : 0.0f, 1.0f, isClicked ? 2.0f : 0.0f,
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f));
animationSet.addAnimation(new AlphaAnimation(1.0f, 0.0f));
animationSet.setDuration(duration);
animationSet.setInterpolator(new DecelerateInterpolator());
animationSet.setFillAfter(true);
return animationSet;
}
示例13: scaleSmallAnimation
import android.view.animation.AnimationSet; //导入方法依赖的package包/类
private Animation scaleSmallAnimation(int duration) {
AnimationSet animationSet = new AnimationSet(true);
ScaleAnimation scaleAnimation = new ScaleAnimation(1.0f, 0.0f, 1.0f, 0.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5F);
AlphaAnimation alphaAnimation = new AlphaAnimation(1.0f, 0.0f);
animationSet.addAnimation(scaleAnimation);
animationSet.addAnimation(alphaAnimation);
animationSet.setDuration(duration);
animationSet.setFillAfter(true);
return animationSet;
}
示例14: createQuitAnimation
import android.view.animation.AnimationSet; //导入方法依赖的package包/类
private AnimationSet createQuitAnimation(View _view, long _offSet) {
AnimationSet _set = new AnimationSet(true);
_set.addAnimation(new AlphaAnimation(1, 0));
_set.addAnimation(new ScaleAnimation(1, 2, 1, 2));
_set.addAnimation(new TranslateAnimation(0, -_view.getWidth() / 2, 0, -_view.getHeight() / 2));
_set.setDuration(150);
_set.setStartOffset(_offSet);
_set.setFillAfter(true);
return _set;
}
示例15: hide
import android.view.animation.AnimationSet; //导入方法依赖的package包/类
public void hide(float x) {
this.lastPositionX = x;
float offset = getOffset(x);
int widthAdjustment = getWidthAdjustment();
AnimationSet animation = new AnimationSet(false);
Animation scaleAnimation = new ScaleAnimation(1, 0.5f, 1, 0.5f,
Animation.RELATIVE_TO_SELF, 0.5f,
Animation.RELATIVE_TO_SELF, 0.5f);
Animation translateAnimation = new TranslateAnimation(Animation.ABSOLUTE, offset + widthAdjustment,
Animation.ABSOLUTE, widthAdjustment,
Animation.RELATIVE_TO_SELF, -.25f,
Animation.RELATIVE_TO_SELF, -.25f);
scaleAnimation.setInterpolator(new AnticipateOvershootInterpolator(1.5f));
translateAnimation.setInterpolator(new DecelerateInterpolator());
animation.addAnimation(scaleAnimation);
animation.addAnimation(translateAnimation);
animation.setDuration(ANIMATION_DURATION);
animation.setFillBefore(true);
animation.setFillAfter(false);
animation.setInterpolator(new AnticipateOvershootInterpolator(1.5f));
recordButtonFab.setVisibility(View.GONE);
recordButtonFab.clearAnimation();
recordButtonFab.startAnimation(animation);
}