3

I have a textview with numbers in it. If the number was changed, i want to animate this. But this shouldn't be a fade in and fade out effect. I want to animate every single number with a vertical flip effect. Is that possible?

Zenco
  • 2,963
  • 3
  • 17
  • 22
  • 1
    what do you mean by `vertical flip effect`? –  Jan 10 '14 at 09:04
  • i mean that the old number will disappear upwards and the new number come from below – Zenco Jan 10 '14 at 09:10
  • 1
    http://www.androidhive.info/2013/06/android-working-with-xml-animations/ see this i think your need is `Slide Up` –  Jan 10 '14 at 09:11

2 Answers2

0

Animation in Android is used by Views.

So, TextView will make animation at whole.

If you want to make animation for each single number then create a lot of TextView as number digits (programmatically) and move the digits from the original TextView to each TextView. Then make animation to all these TextViews.

If the original TextView has the content (301), then you should create three TextView and set the '3' as text to the first TextView and set '0' to the second , and so on.

Niko
  • 8,093
  • 5
  • 49
  • 85
Mahmoud
  • 2,683
  • 1
  • 30
  • 32
  • Thank you. Thats very ugly but if there is no other solution i have to do it like that. – Zenco Jan 10 '14 at 09:46
0

If you are looking for odometer like effect, there are two tutorials and code samples I know of that can help you, BUT you will need to do a custom view to achieve this effect:

http://kevindion.com/2010/12/android-odometer-ui-tutorial-part-2/
https://github.com/Vinayrraj/Android-FlipDigitView

This is the video of the final animation of second tutorial:
https://www.youtube.com/watch?v=d6-M2nN2Gzg&feature=youtu.be

MikeL
  • 5,385
  • 42
  • 41