Time for action - animating the display
In order to build a nice slide-out-slide-in animation for the calculator display, we'll need to define our own animations and bind them to a
ViewSwitcher object. This will also require us to make changes to the Java code in order to handle the new mechanism. Since we don't want the view to animate each time a new digit is typed, we will make direct changes to the
TextView currently on the screen.
- Create a new XML resource file in the
slide_out_top.xml, and open this in an editor or IDE.
- Declare a y-translate animation from
100%as the only element in the animation resource:
<translate xmlns:android="http://schemas.android.com/apk/res/android" android:fromYDelta="0%" android:toYDelta="-100%" ...