Android规模和并行转换

时间:2015-01-06 15:21:44

标签: android android-animation

您好我的onclick动画有问题,请看这里: https://www.youtube.com/watch?v=zX7RkzCFlI4 我的布局中有三个元素,它是:包装,蓝色圆圈和星形。每个元素都有自己的动画:

    getActivity().findViewById(R.id.heart_frame).setVisibility(View.VISIBLE);
    Animation anim = AnimationUtils.loadAnimation(getActivity(), R.anim.translate_logo);
    anim.reset();
    ImageView logo = (ImageView) getActivity().findViewById(R.id.heart);
    logo.clearAnimation();
    logo.startAnimation(anim);

    anim = AnimationUtils.loadAnimation(getActivity(), R.anim.translate_circle);
    anim.reset();
    ImageView iv = (ImageView)  getActivity().findViewById(R.id.heart_circle);
    iv.clearAnimation();
    iv.startAnimation(anim);

    final FrameLayout fr = (FrameLayout) getActivity().findViewById(R.id.heart_frame);
    anim = AnimationUtils.loadAnimation(getActivity(), R.anim.translate_frame);
    anim.setAnimationListener(new Animation.AnimationListener() {
        @Override
        public void onAnimationStart(Animation animation) {

        }

        @Override
        public void onAnimationEnd(Animation animation) {
            getActivity().findViewById(R.id.heart_frame).setVisibility(View.INVISIBLE);
        }

        @Override
        public void onAnimationRepeat(Animation animation) {

        }
    });
    anim.reset();
    fr.clearAnimation();
    fr.startAnimation(anim);

在translate_frame中我得到了:

    <translate android:fromXDelta="0" android:fromYDelta="0"
    android:toXDelta="40%p" android:toYDelta="50%p"
    android:duration="950"
    android:startOffset="700"/>

<scale android:fromXScale="1.0" android:fromYScale="1.0"
    android:toXScale="0.5" android:toYScale="0.5"
    android:startOffset="700"
    android:pivotX="1"
    android:pivotY="1"
    android:duration="290" android:fillBefore="false" />

每一个想法对我来说都有好处,为什么它不适用于物业?你有任何ide如何运行它?

它应该到右下角,刻度为0.5

0 个答案:

没有答案