當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。