当前位置: 首页>>代码示例>>Java>>正文


Java AnimationSet.setAnimationListener方法代码示例

本文整理汇总了Java中android.view.animation.AnimationSet.setAnimationListener方法的典型用法代码示例。如果您正苦于以下问题:Java AnimationSet.setAnimationListener方法的具体用法?Java AnimationSet.setAnimationListener怎么用?Java AnimationSet.setAnimationListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.view.animation.AnimationSet的用法示例。


在下文中一共展示了AnimationSet.setAnimationListener方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();

    }
 
开发者ID:ViewStub,项目名称:ExpandButton,代码行数:27,代码来源:ExpandButtonLayout.java

示例2: slideInUp

import android.view.animation.AnimationSet; //导入方法依赖的package包/类
private void slideInUp(View view, Animation.AnimationListener animationListener) {
    AlphaAnimation fadeIn = new AlphaAnimation(0.0f, 1.0f);
    TranslateAnimation transIn = new TranslateAnimation(
            Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f,
            Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.0f);

    final AnimationSet animationSet = new AnimationSet(true);
    animationSet.addAnimation(fadeIn);
    animationSet.addAnimation(transIn);
    animationSet.setDuration(200);

    if (animationListener != null) {
        animationSet.setAnimationListener(animationListener);
    }

    view.setVisibility(View.VISIBLE);
    view.clearAnimation();
    view.startAnimation(animationSet);
}
 
开发者ID:SimonCherryGZ,项目名称:JewelryUI,代码行数:20,代码来源:MainActivity.java

示例3: close

import android.view.animation.AnimationSet; //导入方法依赖的package包/类
public void close() {

        AnimationSet animationSet = new AnimationSet(true);
        animationSet.setDuration(duration);
        animationSet.setAnimationListener(this);
        animationSet.setFillAfter(true);

        RotateAnimation rotateAnimation = new RotateAnimation(360, 270,
                Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
        animationSet.addAnimation(rotateAnimation);
        Animation scaleAnimation = new ScaleAnimation(1f, 1.25f, 1f, 1.25f,
                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", mLinearLayoutWidth, 0);
        ObjectAnimator animator2 = ObjectAnimator.ofInt(mLinearLayout, "paddingLeft", savePaddingLeft, 0);
        ObjectAnimator animator3 = ObjectAnimator.ofInt(mLinearLayout, "paddingRight", savePaddingRight, 0);
        ObjectAnimator animator4 = ObjectAnimator.ofInt(mLinearLayout, "marginLeft", saveMarginLeft, 0);
        ObjectAnimator animator5 = ObjectAnimator.ofInt(mLinearLayout, "marginRight", saveMarginRight, 0);
        animatorSet.playTogether(animator1, animator2, animator3, animator4, animator5);
        animatorSet.setDuration(duration).start();

    }
 
开发者ID:ViewStub,项目名称:ExpandButton,代码行数:25,代码来源:ExpandButtonLayout.java

示例4: animateFakeClearing

import android.view.animation.AnimationSet; //导入方法依赖的package包/类
/**
 * Hides every view in a RecyclerView to simulate clearing the RecyclerView
 * returns how long the animation takes to complete.
 * Returns -1 if there is nothing to animate
 */
public static int animateFakeClearing(int lastVisibleItemPosition, int firstVisibleItemPosition, AutoSpanRecyclerView aRecyclerView, Animation.AnimationListener animationListener, boolean includeTranslation) {
	final int DELAY_BETWEEN = 50;
	int clearingDuration = 0;

	int startPositionCol = getColumnPosFromIndex(firstVisibleItemPosition, aRecyclerView);
	int startPositionRow = getRowPosFromIndex(firstVisibleItemPosition, aRecyclerView);

	for(int i = lastVisibleItemPosition; i >= firstVisibleItemPosition; i--) {
		final View VIEW = aRecyclerView.getChildAt(lastVisibleItemPosition - i);

		int positionColumnDistance = Math.abs(getColumnPosFromIndex(i, aRecyclerView) - startPositionCol);
		int positionRowDistance = Math.abs(getRowPosFromIndex(i, aRecyclerView) - startPositionRow);
		int delay = (positionColumnDistance + positionRowDistance) * DELAY_BETWEEN + 1;

		AnimationSet mHideAnimations = AnimationService.startAlphaHideAnimation(delay, VIEW, includeTranslation);
		if (mHideAnimations == null) {
			return -1;
		}
		int hideAnimationDuration = (int) mHideAnimations.getDuration();

		if (hideAnimationDuration + delay > clearingDuration) {
			clearingDuration = hideAnimationDuration + delay;
		}

		// If the view is the last to animate, then start the intent when the animation finishes.
		if(i == lastVisibleItemPosition && animationListener != null) {
			mHideAnimations.setAnimationListener(animationListener);
		}
	}

	return clearingDuration;
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:38,代码来源:AnimationService.java


注:本文中的android.view.animation.AnimationSet.setAnimationListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。