I have ViewSwitcher with two ImageView. It has crossfade animation (as first appears, the other disappears). It is Done using AlphaAnimation
, and
viewSwitcher.setInAnimation(inAlphaAnimation);
viewSwitcher.setOutAnimation(fadeAlphaAnimation);
Is very smooth and nice. But I wanted to make gif from it and so, I took screenshots from a layout to "catch frames" and created a gif from it. It is all good. But I need the animation itself to be like a gif with a frame rate, so it won't be smooth. Is it possible to heave such effect? Thank you.
I searched around more and found this: https://developer.android.com/guide/topics/graphics/prop-animation.html
Frame refresh delay: You can specify how often to refresh frames of your animation. The default is set to refresh every 10 ms, but the speed in which your application can refresh frames is ultimately dependent on how busy the system is overall and how fast the system can service the underlying timer.
I found this method that sets frame rate to all animations:
ValueAnimator.setFrameDelay(long frameDelay);
Hope this will help others)