mAnimationSet.addAnimation(alphaAnim); mAnimationSet.setDuration(mDuration); mAnimationSet.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) {
animationSet.setDuration(1500); animationSet.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) {
mAnimationSet.addAnimation(alphaAnim); mAnimationSet.setDuration(mDuration); mAnimationSet.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) {
set.addAnimation(translateAnimationX); set.setDuration(800);// 动画的执行时间 set.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) {
public void dismiss() { AnimationSet shrinkAnimation = createAnimation(false); shrinkAnimation.setAnimationListener(mShrinkAnimationListener); mRoot.startAnimation(shrinkAnimation); }
public A listener(Animation.AnimationListener listener) { animSet.setAnimationListener(listener); return this; }
private void initAnimListener() { mAnimOut.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { mDialogView.post(new Runnable() { @Override public void run() { callDismiss(); } }); } @Override public void onAnimationRepeat(Animation animation) { } }); }
private void initAnimListener() { mAnimOut.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { mDialogView.post(new Runnable() { @Override public void run() { callDismiss(); } }); } @Override public void onAnimationRepeat(Animation animation) { } }); }
private void hideWel(final FrameLayout frameLayout) { AnimationSet outSet = getOutSet(); outSet.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { frameLayout.startAnimation(AnimationUtils.loadAnimation(MainActivity.this, R.anim.content_out)); frameLayout.setVisibility(View.GONE); } @Override public void onAnimationRepeat(Animation animation) { } }); welImg.startAnimation(outSet); }
private void hideWel(final FrameLayout frameLayout) { AnimationSet outSet = getOutSet(); outSet.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { frameLayout.startAnimation(AnimationUtils.loadAnimation(MainActivity.this, R.anim.content_out)); frameLayout.setVisibility(View.GONE); } @Override public void onAnimationRepeat(Animation animation) { } }); welImg.startAnimation(outSet); }
private void animateDownOut(@NonNull final View contentView) { TranslateAnimation translate = new TranslateAnimation( Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 1f ); AlphaAnimation alpha = new AlphaAnimation(1, 0); AnimationSet set = new AnimationSet(true); set.addAnimation(translate); set.addAnimation(alpha); set.setInterpolator(new DecelerateInterpolator()); set.setDuration(200); set.setFillAfter(true); set.setAnimationListener(createAnimationListener(contentView)); contentView.startAnimation(set); }
public static int moveThree(AnimationListener activity, View apa, int animationmove) { Log.v("MOVETHREE", "Started move3"); AnimationSet picMov3 = new AnimationSet(true); picMov3.setAnimationListener(activity); AlphaAnimation fadein = new AlphaAnimation((float) 0.4, 1); // rotate1.setStartOffset(50); fadein.setDuration(duration); picMov3.addAnimation(fadein); TranslateAnimation trans1 = new TranslateAnimation(-400, -400, 0, 0); trans1.setDuration(duration); picMov3.setFillAfter(true); picMov3.addAnimation(trans1); apa.startAnimation(picMov3);
private void showViewWithAnimation(final View view) { view.setVisibility(View.VISIBLE); Animation a3 = new TranslateAnimation(0, 0, -50, 0); Animation a4 = new AlphaAnimation(0.2f, 1); AnimationSet set2 = new AnimationSet(true); set2.setInterpolator(ThreadActivity.this, android.R.interpolator.accelerate_decelerate); set2.addAnimation(a3); set2.addAnimation(a4); set2.setDuration(250); set2.setRepeatMode(Animation.REVERSE); set2.setAnimationListener(new AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { view.setVisibility(View.VISIBLE); } }); view.startAnimation(set2); }
private void dismissViewWithAnimation(final View view) { Animation a1 = new TranslateAnimation(0, 0, 0, -100); Animation a2 = new AlphaAnimation(1, 0.2f); AnimationSet set = new AnimationSet(true); set.setInterpolator(ThreadActivity.this, android.R.interpolator.decelerate_cubic); set.addAnimation(a1); set.addAnimation(a2); set.setDuration(300); set.setRepeatMode(Animation.REVERSE); set.setAnimationListener(new AnimationListener() { @Override public void onAnimationStart(Animation animation) { animating.set(true); } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { view.setVisibility(View.INVISIBLE); animating.set(false); } }); view.startAnimation(set); }
@Override public void onAnimationEnd(Animation animation) { AnimationSet shrinkAnimationSet = new AnimationSet(true); shrinkAnimationSet.addAnimation(new ScaleAnimation(2.0f, 1.0f, 2.0f, 1.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f)); shrinkAnimationSet.setDuration(1000); shrinkAnimationSet.setInterpolator(new DecelerateInterpolator()); shrinkAnimationSet.setFillAfter(false); heartbeatView.startAnimation(shrinkAnimationSet);// 动画结束时重新开始,实现心跳的View shrinkAnimationSet.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { playHeartbeatAnimation(heartbeatView); } @Override public void onAnimationRepeat(Animation animation) { } }); } });
/** * 按键点击退出动画 */ private void resolveButtonClickAnimationOut(final View view) { 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.setInterpolator(new AccelerateInterpolator()); animationSet.setDuration(200); animationSet.setFillAfter(false); animationSet.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { view.setVisibility(GONE); isOpen = false; } @Override public void onAnimationRepeat(Animation animation) { } }); view.startAnimation(animationSet); }
private Animation addAnimation(int duration, Animation.AnimationListener animationListener) { AnimationSet animationSet = new AnimationSet(true); Animation alphaAnimation = new AlphaAnimation(1, 0); alphaAnimation.setFillAfter(true); animationSet.addAnimation(alphaAnimation); Animation largeAnimation = new ScaleAnimation(0f, 1.0f, 0f, 1.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); largeAnimation.setFillAfter(true); animationSet.addAnimation(largeAnimation); animationSet.setDuration(duration); animationSet.setAnimationListener(animationListener); animationSet.setFillAfter(true); return animationSet; }
{ Animation scaleYAnim = AnimationUtils.loadAnimation(context, R.anim.fill_y); Animation scaleXAnim = AnimationUtils.loadAnimation(context, R.anim.fill_x); AnimationSet scaleAnim = new AnimationSet(false); scaleAnim.addAnimation(scaleXAnim); scaleAnim.addAnimation(scaleYAnim); scaleAnim.setFillEnabled(true); scaleAnim.setFillAfter(true); onsite_background.startAnimation(scaleAnim); scaleAnim.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation arg0) { onsite_background.setVisibility(View.VISIBLE); } @Override public void onAnimationRepeat(Animation arg0) { } @Override public void onAnimationEnd(Animation arg0) { Log.v("onAnimationEnd", "scaleAnim"); mSignOuthButton.setTextColor(Color.WHITE); } }); }
public HHProgressAlertDialog(Context context) { super(context, R.style.alert_dialog); //默认返回键可以取消 setCancelable(true); //其他区域不可取消 setCanceledOnTouchOutside(false); mModalInAnim = (AnimationSet) OptAnimationLoader.loadAnimation(getContext(), R.anim.modal_in); mModalOutAnim = (AnimationSet) OptAnimationLoader.loadAnimation(getContext(), R.anim.modal_out); mModalOutAnim.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { mDialogView.post(new Runnable() { @Override public void run() { if (mCloseFromCancel) { HHProgressAlertDialog.super.cancel(); } else { HHProgressAlertDialog.super.dismiss(); } } }); } @Override public void onAnimationRepeat(Animation animation) { } }); }
private void disapper() { int size = getChildCount(); for (int i = size - 1; i >= 0; i--) { final TextView txt = (TextView) getChildAt(i); if (txt.getVisibility() == View.GONE) { removeView(txt); continue; } LayoutParams layParams = (LayoutParams) txt.getLayoutParams(); // Log.d("ANDROID_LAB", txt.getText() + " leftM=" + // layParams.leftMargin + " topM=" + layParams.topMargin // + " width=" + txt.getWidth()); int[] xy = new int[] { layParams.leftMargin, layParams.topMargin, txt.getWidth() }; AnimationSet animSet = getAnimationSet(xy, (width >> 1), (height >> 1), txtAnimOutType); txt.startAnimation(animSet); animSet.setAnimationListener(new AnimationListener() { public void onAnimationStart(Animation animation) { } public void onAnimationRepeat(Animation animation) { } public void onAnimationEnd(Animation animation) { txt.setOnClickListener(null); txt.setClickable(false); txt.setVisibility(View.GONE); } }); } }