1.setAnimation 과 startAnimation 의 차이

1339 단어 Android개발 노트
애니메이션 재생 을 설정 합 니 다.즉시 재생 하고 싶 은 애니메이션 은 startAnimation 을 사용 하여 입자 조절 을 허용 하 는 시작 시간 과 실 효 를 제공 합 니 다.
그러나 1)애니메이션 시작 시간 2)애니메이션 이 시작 해 야 할 관점 은 무효 로 간주 되 어야 합 니 다.

    /**
     * Sets the next animation to play for this view.
     * If you want the animation to play immediately, use
     * startAnimation. This method provides allows fine-grained
     * control over the start time and invalidation, but you
     * must make sure that 1) the animation has a start time set, and
     * 2) the view will be invalidated when the animation is supposed to
     * start.
     *
     * @param animation The next animation, or null.
     */
    public void setAnimation(Animation animation) {
        mCurrentAnimation = animation;
        if (animation != null) {
            animation.reset();
        }
    }

지금부터 지정 한 애니메이션 을 시작 합 니 다.
    /**
     * Start the specified animation now.
     *
     * @param animation the animation to start now
     */
    public void startAnimation(Animation animation) {
        animation.setStartTime(Animation.START_ON_FIRST_FRAME);
        setAnimation(animation);
        invalidateParentCaches();
        invalidate(true);
    }

사용 을 권장 하 다
startAnimation 은 애니메이션 을 시작 합 니 다.setAnimation 은 애니메이션 을 시작 하 는 데 조건 이 필요 합 니 다.

좋은 웹페이지 즐겨찾기