Android:ViewFlipper animation

我是研究僧i 提交于 2019-12-05 08:54:11

You want to use setOutAnimation() and setInAnimation().

Well this a very old post. but still the fix is here:

you need to call viewFlipper.setOutAnimation(null) and viewFlipper.setInAnimation(null) to reset the animation .

   @Override
        public void onClick(View v)
        {
        if (v.equals(mNext))
        {
            mViewFlipper.setOutAnimation(null);

             mViewFlipper.setInAnimation(null);
              mViewFlipper.setInAnimation(AnimationUtils.loadAnimation(v.getContext(), R.anim.left_in));

        vf.setOutAnimation(AnimationUtils.loadAnimation(v.getContext(), R.anim.right_out));

            mViewFlipper.showNext();

        }
        else if (v.equals(mPrev))
        {

            mViewFlipper.setOutAnimation(null);

             mViewFlipper.setInAnimation(null);

            mViewFlipper.setInAnimation(AnimationUtils.loadAnimation(v.getContext(), R.anim.right_in));

        mViewFlipper.setOutAnimation(AnimationUtils.loadAnimation(v.getContext(), R.anim.left_out));

             mViewFlipper.showPrevious();
        }

        }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!