Simple Animation on native Android Development

0
339

In this tutorial we are going to learn the basics of Animation in native Android Development.

Before we start why does Animation plays an important role in the creation of Systems,Websites,Applications and Games? That is because Animation gives user more connection to the System or Application, it enhances its capability to simplify complex instruction thus making it more user friendly, Animation is now a standard of the technological society it makes your work Lively and Interactive by doing effects such as Slides, Fades, Color Changes and many more.

Let’s start by creating our interface.

What we are going to do is to animate the image(Ball) inside the its layout.

Create a layout.

Copy the codes below and paste it inside your layout.xml file.

After the completion of the interface what we need to do is to create a folder named “anim” inside the “res” folder.

Next we need to create .xml file for the animation.

Copy the codes below for the animations.

slide_down.xml

slide_left.xml

slide_right.xml

slide_up.xml

Before we proceed in the activity file, we need to discus on how the animation works in xml.

Animation is based on the axes of a Cartesian Plane in Mathematics “X” is for the horizontal and “Y” is for the vertical lines, and both meets at point 0, also called the origin or the starting position of your Element/Image.

 

But the difference is,in here the Y-axis is inverted making all the negative integers hits the upper portion while the positive integers hits the lower potion.

Now we go on our activity file.

Let’s start with the basic, by declaring all the elements to be used on our application.

Here on how to start animation by Clicking the button.

And to complete the four four button copy the codes below.

Here is the result.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

That’s all.

Download “SimpleAnimation.rar” SimpleAnimation.rar – Downloaded 33 times – 1 MB