Adding animations to your app interface will give high quality feel to your android applications. Animations can be performed through either XML or android code. In this tutorial i explained how to do animations using XML notations. I will explain how to do the same using android java code in future tutorials. Here i covered basic android animations like fade in, fade out, scale, rotate, slide up, slide down etc.,

android animations using xml

In the source code project provided in this tutorial, I wrote separate activity and XML for each animation. Download and play with the code to get familiar with the animations. Following are list of animations covered in this article.

android animations using xml

Basic steps to perform animation

Following are the basic steps to perform an animation on any UI element. Creating animation is very simple, all it needs is creating necessary files and write small pieces of code.

Step 1: Create xml that defines the animation

Create an xml file which defines type of animation to perform. This file should be located under anim folder under res directory (res ⇒ anim ⇒ animation.xml). If you don’t have anim folder in your res directory create one. Following is example of simple fade in animation.

android animation anim folder
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:fillAfter="true" >

    <alpha
        android:duration="1000"
        android:fromAlpha="0.0"
        android:interpolator="@android:anim/accelerate_interpolator"
        android:toAlpha="1.0" />

</set>

Step 2: Load the animation

Next in your activity create an object of Animation class. And load the xml animation using AnimationUtils by calling loadAnimation function.

public class FadeInActivity extends Activity{

	TextView txtMessage;

	// Animation
	Animation animFadein;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_fadein);

		txtMessage = (TextView) findViewById(R.id.txtMessage);

		// load the animation
		animFadein = AnimationUtils.loadAnimation(getApplicationContext(),
				R.anim.fade_in);		
	}
}

Step 3: Set the animation listeners (Optional)

If you want to listen to animation events like start, end and repeat, your activity should implements AnimationListener. This step is optional. If you implement AnimationListener you will have to override following methods.

onAnimationStart – This will be triggered once the animation started
onAnimationEnd – This will be triggered once the animation is over
onAnimationRepeat – This will be triggered if the animation repeats

public class FadeInActivity extends Activity implements AnimationListener {
.
.
.
// set animation listener
animFadein.setAnimationListener(this);
.
.
.
// animation listeners
	@Override
	public void onAnimationEnd(Animation animation) {
		// Take any action after completing the animation
		// check for fade in animation
		if (animation == animFadein) {
			Toast.makeText(getApplicationContext(), "Animation Stopped",
					Toast.LENGTH_SHORT).show();
		}

	}

	@Override
	public void onAnimationRepeat(Animation animation) {
		// Animation is repeating
	}

	@Override
	public void onAnimationStart(Animation animation) {
		// Animation started
	}

Step 4: Finally start the animation

You can start animation whenever you want by calling startAnimation on any UI element by passing the type of animation. In this example i am calling fade in animation on TextView.

// start the animation
txtMessage.startAnimation(animFadein);

Complete Code

Following is complete code for FadeInActivity

package info.androidhive.androidanimations;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.Animation.AnimationListener;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

public class FadeInActivity extends Activity implements AnimationListener {

	TextView txtMessage;
	Button btnStart;

	// Animation
	Animation animFadein;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_fadein);

		txtMessage = (TextView) findViewById(R.id.txtMessage);
		btnStart = (Button) findViewById(R.id.btnStart);

		// load the animation
		animFadein = AnimationUtils.loadAnimation(getApplicationContext(),
				R.anim.fade_in);
		
		// set animation listener
		animFadein.setAnimationListener(this);

		// button click event
		btnStart.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				txtMessage.setVisibility(View.VISIBLE);
				
				// start the animation
				txtMessage.startAnimation(animFadein);
			}
		});

	}

	@Override
	public void onAnimationEnd(Animation animation) {
		// Take any action after completing the animation

		// check for fade in animation
		if (animation == animFadein) {
			Toast.makeText(getApplicationContext(), "Animation Stopped",
					Toast.LENGTH_SHORT).show();
		}

	}

	@Override
	public void onAnimationRepeat(Animation animation) {
		// TODO Auto-generated method stub

	}

	@Override
	public void onAnimationStart(Animation animation) {
		// TODO Auto-generated method stub

	}

}

Important XML animation attributes

When working with animations it is better to have through knowledge about some of the important XML attributes which create major differentiation in animation behavior. Following are the important attributes you must known about.

android:duration – Duration of the animation in which the animation should complete

android:startOffset – It is the waiting time before an animation starts. This property is mainly used to perform multiple animations in a sequential manner

android:interpolator – It is the rate of change in animation

android:fillAfter – This defines whether to apply the animation transformation after the animation completes or not. If it sets to false the element changes to its previous state after the animation. This attribute should be use with <set> node

android:repeatMode – This is useful when you want your animation to be repeat

android:repeatCount – This defines number of repetitions on animation. If you set this value to infinite then animation will repeat infinite times

Some useful animations

Following i am giving xml code to perform lot of useful animations. Try to assign different values to xml attributes to see change in animations.

1. Fade In
2. Fade Out
3. Cross Fading
4. Blink
5. Zoom In
6. Zoom Out
7. Rotate
8. Move
9. Slide Up
10. Slide Down
11. Bounce
12. Sequential Animation
13. Together Animation

Fade In

For fade in animation you can use <alpha> tag which defines alpha value. Fade in animation is nothing but increasing alpha value from 0 to 1.

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:fillAfter="true" >

    <alpha
        android:duration="1000"
        android:fromAlpha="0.0"
        android:interpolator="@android:anim/accelerate_interpolator"
        android:toAlpha="1.0" />

</set>

Fade Out

Fade out is exactly opposite to fade in, where we need to decrease the alpha value from 1 to 0

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:fillAfter="true" >

    <alpha
        android:duration="1000"
        android:fromAlpha="1.0"
        android:interpolator="@android:anim/accelerate_interpolator"
        android:toAlpha="0.0" />

</set>

Cross Fading

Cross fading is performing fade in animation while other element is fading out. For this you don’t have to create separate animation file, you can just use fade_in.xml and fade_out.xml files.

In the following code i loaded fade in and fade out, then performed them on two different UI elements.

TextView txtView1, txtView2;
Animation animFadeIn, animFadeOut;
.
.
// load animations
animFadeIn = AnimationUtils.loadAnimation(getApplicationContext(),
				R.anim.fade_in);
animFadeOut = AnimationUtils.loadAnimation(getApplicationContext(),
				R.anim.fade_out);
.
.
// set animation listeners
animFadeIn.setAnimationListener(this);
animFadeOut.setAnimationListener(this);

.
.
// Make fade in elements Visible first
txtMessage2.setVisibility(View.VISIBLE);

// start fade in animation
txtMessage2.startAnimation(animFadeIn);
				
// start fade out animation
txtMessage1.startAnimation(animFadeOut);

Blink animation is animating fade out or fade in animation in repetitive fashion. For this you will have to set android:repeatMode=”reverse” and android:repeatCount attributes.

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
    <alpha android:fromAlpha="0.0"
        android:toAlpha="1.0"
        android:interpolator="@android:anim/accelerate_interpolator"
        android:duration="600"
        android:repeatMode="reverse"
        android:repeatCount="infinite"/>
</set>

Zoom In

For zoom use <scale> tag. Use pivotX=”50%” and pivotY=”50%” to perform zoom from the center of the element. Also you need to use fromXScale, fromYScale attributes which defines scaling of the object. Keep these value lesser than toXScale, toYScale

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:fillAfter="true" >

    <scale
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:duration="1000"
        android:fromXScale="1"
        android:fromYScale="1"
        android:pivotX="50%"
        android:pivotY="50%"
        android:toXScale="3"
        android:toYScale="3" >
    </scale>

</set>

Zoom Out

Zoom out animation is same as zoom in but toXScale, toYScale values are lesser than fromXScale, fromYScale

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:fillAfter="true" >

    <scale
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:duration="1000"
        android:fromXScale="1.0"
        android:fromYScale="1.0"
        android:pivotX="50%"
        android:pivotY="50%"
        android:toXScale="0.5"
        android:toYScale="0.5" >
    </scale>

</set>

Rotate

Rotate animation uses <rotate> tag. For rotate animation required tags are android:fromDegrees and android:toDegrees which defines rotation angles.

Clock wise – use positive toDegrees value
Anti clock wise – use negative toDegrees value

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
    <rotate android:fromDegrees="0"
        android:toDegrees="360"
        android:pivotX="50%"
        android:pivotY="50%"
        android:duration="600"
        android:repeatMode="restart"
        android:repeatCount="infinite"
        android:interpolator="@android:anim/cycle_interpolator"/>

</set>

Move

In order to change position of object use <translate> tag. It uses fromXDelta, fromYDelta for X-direction and toXDelta, toYDelta attributes for Y-direction.

<?xml version="1.0" encoding="utf-8"?>
<set
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:interpolator="@android:anim/linear_interpolator"
    android:fillAfter="true">

   <translate
        android:fromXDelta="0%p"
        android:toXDelta="75%p"
        android:duration="800" />
</set>

Slide Up

Sliding animation uses <scale> tag only. Slide up can be achieved by setting android:fromYScale=”1.0″ and android:toYScale=”0.0″

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:fillAfter="true" >

    <scale
        android:duration="500"
        android:fromXScale="1.0"
        android:fromYScale="1.0"
        android:interpolator="@android:anim/linear_interpolator"
        android:toXScale="1.0"
        android:toYScale="0.0" />

</set>

Slide Down

Slide down is exactly opposite to slide down animation. Just interchange android:fromYScale and android:toYScale values.

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:fillAfter="true">

    <scale
        android:duration="500"
        android:fromXScale="1.0"
        android:fromYScale="0.0"
        android:interpolator="@android:anim/linear_interpolator"
        android:toXScale="1.0"
        android:toYScale="1.0" />

</set>

Bounce

Bounce is just an animation effect where animation ends in bouncing fashion. For this set android:interpolator value to @android:anim/bounce_interpolator. This bounce can be used with any kind animation. Following slide down example uses bounce effect.

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:fillAfter="true"
    android:interpolator="@android:anim/bounce_interpolator">

    <scale
        android:duration="500"
        android:fromXScale="1.0"
        android:fromYScale="0.0"
        android:toXScale="1.0"
        android:toYScale="1.0" />

</set>

Sequential Animation

If you want to perform multiple animation in a sequential manner you have to use android:startOffset to give start delay time. The easy way to calculate this value is to add the duration and startOffset values of previous animation. Following is a sequential animation where set of move animations performs in sequential manner.

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:fillAfter="true"
    android:interpolator="@android:anim/linear_interpolator" >

    <!-- Use startOffset to give delay between animations -->


    <!-- Move -->
    <translate
        android:duration="800"
        android:fillAfter="true"
        android:fromXDelta="0%p"
        android:startOffset="300"
        android:toXDelta="75%p" />
    <translate
        android:duration="800"
        android:fillAfter="true"
        android:fromYDelta="0%p"
        android:startOffset="1100"
        android:toYDelta="70%p" />
    <translate
        android:duration="800"
        android:fillAfter="true"
        android:fromXDelta="0%p"
        android:startOffset="1900"
        android:toXDelta="-75%p" />
    <translate
        android:duration="800"
        android:fillAfter="true"
        android:fromYDelta="0%p"
        android:startOffset="2700"
        android:toYDelta="-70%p" />

    <!-- Rotate 360 degrees -->
    <rotate
        android:duration="1000"
        android:fromDegrees="0"
        android:interpolator="@android:anim/cycle_interpolator"
        android:pivotX="50%"
        android:pivotY="50%"
        android:startOffset="3800"
        android:repeatCount="infinite"
        android:repeatMode="restart"
        android:toDegrees="360" />

</set>

Together Animation

Performing all animation together is just writing all animations one by one without using android:startOffset

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:fillAfter="true"
    android:interpolator="@android:anim/linear_interpolator" >

    <scale
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:duration="4000"
        android:fromXScale="1"
        android:fromYScale="1"
        android:pivotX="50%"
        android:pivotY="50%"
        android:toXScale="4"
        android:toYScale="4" >
    </scale>

    <!-- Rotate 180 degrees -->
    <rotate
        android:duration="500"
        android:fromDegrees="0"
        android:pivotX="50%"
        android:pivotY="50%"
        android:repeatCount="infinite"
        android:repeatMode="restart"
        android:toDegrees="360" />

</set>

I hope you like this tutorial, feel free to ask any kind of questions in the comment section.

Thank You

Hi there! I am Founder at androidhive and programming enthusiast. My skills includes Android, iOS, PHP, Ruby on Rails and lot more. If you have any idea that you would want me to develop? Let’s talk: ravi@androidhive.info
  • paul getty

    awesome God bless you, this just came in timely for me, please keep posting more tutorial, i always look forward to your tutorials!! Simply awesome, am from nigeria and your tutorial has been handy and useful. Thank you once again! God Bless you !!!!!!

    • Thank you Paul, same to you.

      • akhilesh

        thanks a lot

        • arun

          hi explain me clearly

  • Rajesh

    Hi Ravi , i love your site. i am begginer and learning android from most of your posts.
    God job… Keep it up….

  • Darshan

    nice tutorial……..it just helped me lot to complete my task…

    Thanks..

    Darshan

  • chhote lal pal

    Dear As your keep posting more tutorial, i always look forward to your tutorials!! and your tutorial has been handy and useful. that way i had start up development help up tutorials. God Bless you !!!!!!

  • Darshan

    how to implement that facebook login screen type of application supporting both landscape as well portrait mode…

  • Narendra Reddy

    Ravi,Nice Post It helped me a lot….Great work

  • RK

    Really nice one. Thanks a lot.

    I have one question,

    Animation does not really moves the layout so it’s position on the display remains the same. So if we have one button in layout and doing animation on that will lose button click.

    So please guide also on that issue.

    Thank you.

    • Hussnain Azam

      i have the same question but did’nt got answer

      • @d4c98aa5bca1b99e7d44fafa076fcf3e:disqus @hussnainazam:disqus I didn’t get you clearly guys. Please explain me little bit more

        • Hussnain Azam

          lets assume i have a button with on-click listener at position x.after animation i move it to position x+10.though the button moves but click listener doesn’t work in this new position.listener remain bind to old position

          • kartik

            @Hussnain Azam If you want that click listener should work for the button after the animation , you have to use object animation. It always keep the functionality of the view.

          • Pranav Mahajan

            What exactly do u mean by abject animation. Can u give some example or link

          • Akhil Srivas

            All is ok with translation and after the animation ends. Now I have the same problem with a set of buttons in rotation and i’m trying to call onClick while rotating. So what to do if i need to call DURING animation? If i need to use object animation can u give me the details please?

          • Muhammad Babar

            refer this link i have explained http://stackoverflow.com/a/15808679/1939564

  • amine

    very good job thanks!

    • er

      yup!

  • Hernan

    Thank you Ravi!

  • Antony Kor

    Excelent! I have been waiting for this. Once again, excelent work Ravi, keep it up! 🙂

  • VASU

    Hi ravi its awesome can you post an article for photo editing like adding comments,drawing some symbols on pic and saving that pic in mysql database
    no one is providing photo editing content ……………………
    please provide some example on this RAVI

  • Anusha

    Thank you ravi .you are helping so much for beginners.i am following your tutorial itself.

  • Anusha

    i am new to android and animations.How we can animate the background colors and add to the application.

  • VASU

    thanks

  • VASU

    Its awesome ravi
    can you post some article on PHOTO EDITING IN ANDROID LIKE DRAWING SYMBOLS ON THE PIC AND SAVING THAT EDITED PIC IN DB………..
    i searched many blogs ravi no one is providing this information……………..
    please help us in this topic ravi
    can you post some example on photo editing ?

  • İsmail Kocacan

    Great Thanks.

  • rank

    great post

  • It’s excellent this post, thanks a lot !!!

  • Surjit Sidhu

    HI!
    i want to animation behave like facebook comments box do.
    please help me, how to do this.

    Thank You

  • aid

    Thanks you sir, very nice tutorial. God bless

  • Anon

    Hey Ravi, I’ve been following your tutorials since the original post- they’ve been fantastic in aiding my personal growth in the Android Development space. I can’t thank you enough. Thanks mate 🙂

  • Ravi Sharma

    this is very helpfull artical

  • Serysew

    Thanks a lot >>>>>>> Cool blog!!!!!!!!!!!!!

  • surabhi

    superb..really very much helpful

  • Minh Nguyen

    thank you very much. It’s really nice and clear

  • thanks, this is a good tutorials

  • kenvin

    thanks you

  • Guest

    123456

  • Devganiya hitesh

    can we apply these animation to full xml page??????

  • Krishna Hrishitha

    Nice tutorial, it is useful one.

  • Eshan

    Great tutorial thanks

  • JAson

    hi im jason can you give a code in swiping image with zoom in and out
    thank you

  • Julio Vergara

    Thanks a lot Ravi

  • nilkash

    Ossum Creation. Thank you for such a valuable post .. 🙂

  • Arun Yadav

    Awesome tutorial… the way you explain and organize your tutorial its awesome. I learned Android from your blog and I’m really thankful to you.

  • Abdul Mohsin

    Great Tutorial!!!……..very helpful . thanks

  • Anand Jain

    Thanks…Its an awesome tutorial. Everything explained in a very easy manner..

    • ravi

      welcome

  • Rana Ranvijay Singh

    These tutorials are really helpful … thnx a lot dude.

  • Rupesh

    Awesome tutorial… the way you explain and organize your tutorial its
    awesome. I learned Android from your blog and I’m really thankful to
    you.

  • jukoor

    Nice Code, Nice Examples, perfect! Keep on this good work. maybe you could add to this tutorial how to start animation just after a few seconds (setStartOffset(5000)).

  • ShahNawaz Khan

    how to use these anims on activities?? i wanna get rid of that slide anim when an activity is called!

  • Zahuranecs

    Is there any way to stop a slide up activity when it reaches a certain point?

  • Pranav Mahajan

    Great tutorial!!!

    Q- If in move.xml I want to move some button from its current position to 25% towards left. Then how do I calculate fromXDelta & toXDelta??

  • Raheel Adnan

    Great Tutorial

  • Khosbayar

    hey guys i have a prob,
    how to use zoom in with zoom out ?
    i want to zoom out shape first, then zoom in my shape back
    how how how????
    Please help me guys!!!

    • Hemant

      Set android:fillAfter=”false”.

      It will set the view into original shape after animation.

  • Kukku

    Just Miracle…thanks..

  • Thanks a lot, It is really cool!! but I have one error:
    after adding the xml files to android anim folder as you said, the eclipse cannot recognize it and is thus resulting in an error whenever i’m trying to load the animation.

  • Suvi

    Thans a lot…. This is really helpful….

  • Anand

    I am unable to download source code. Please help me.

  • me

    This is a great tutorial for beginners. Thanks dude.

  • Kirill

    Thank You very much! You have a talent of well-structured explanation!

  • Vektor

    Really nice info here, I wonder if you can create a curl page animation using the same technique.

  • Mtuli

    can you help me, i want to draw a soccer field and make circles to represent players

  • Dieguillo App

    Very very good post, congrats

  • Aamir

    very helpful and clear article easy to understand thanks.

  • Aamir

    beautifully explained

  • jun

    Can you help me i want to develop an anime that talks like human using Android animation

  • Ayuchuco!

    Nice and neat tutorial!!!
    But I have one question….. how do I achieve an animation like “slide up” but instead of “shrinking” the image from bottom to up, I want it to “expand” it from bottom to up???

  • Project Hydrux

    Not gonna lied, you have remarkable tutorials

  • sidhi

    its very helpful.. thank you 🙂

  • Kris

    hi Ravi, your tutorials are really helpful, can you try to post one with showing how to animate listview on activity open or page load

  • harun

    thanks, really great help

  • Great Tutorial.

  • Vijjeswarapu Esther

    can you tell me how to animate an ocean in images like cartoon ?

  • Kris

    Can you post tutorial on how to create list view animations on load?

  • לאה רביד

    Very clear, you help me!

  • Ranjeev Atwal

    What is activity_fadein?

    • Ranjeev Atwal

      Got…it. Great tutorial

      • Lissi

        you got it?, then can you explain where I can find it, because in my file this won’t work :/

  • Henry

    Thank you!!!!

  • ajay

    sir i used translate.xml in my android project.

    But when i display the bottom and top dimension of view using Log.i(“top”,””+view.getBottom). It shows a constant value. Don’t know what is the problem? Should i implement it programatically ?
    Please provide the solution asap.

  • shivi

    excellent it helps me alot during work :):)

  • Augstin

    I cannot begin to thank you for the tutorial. Thanks to you I have finished my game and uploaded on google play.
    Here is the link if you are interested.

    https://play.google.com/store/apps/details?id=com.pointbanditshoot

  • Aurang Zeb

    Awesome. My first practice with android animation. Explained very well. Keep it up . Thanks sir.

  • Micheal

    Thanks for the tutorial. But, I’m confuse with anim/accelarate_interpolator part. Is that something you decide? or it’s from Android library? btw, I super super new to Android. Thanks again

  • tejdeep

    it’s really awsome i understand very well

  • nnns

    good yar ………..thanks

    • Champak

      THnx yaar.

      • champak

        welcome yaar

  • sandhu

    good

  • abhishek

    not able to download the code

  • Mohit garg

    hello sir

    i want to make

    Genie Effect Animation. Can u please me .How to make this animation

    thanks

  • Muhammad Usman

    Can i make ‘Button Up’ then ‘Button Down’ infinitely:
    button goes up smoothly but goes down with a glitch, i think its because “Up animation” is infinite it starts again, without letting it go down.
    my code is:

    • Harshit Shetty

      try only

      translate android:fromydelta=”0″ android:toydelta=”-4%p” android:repeatmode=”reverse” android:repeatcount=”infinite” android:duration=”600″/>

  • Nirob

    I just want to create zoom in constantly animation like shareit recived friend search animation. For this issue i created a shpe and set in view. but when i m starting one animation 2nd animation need to start first animation after some moment and it will be going constantly. could u help me ???

    • Albert Newton

      So create it.
      Why are you telling us.

      • Sachin Gowda

        what an idiot… : |

  • Prerna Gupta

    I want to know more about android animations and its properties
    theoretically. Can anyone tell me from where I can get the material for
    the same? Any Link would be helpful. Thanx in advance.

  • Paolo

    Hello, is possible change speed of xml animation from java ? tank you

    • hung

      you change the duration

  • Thank you so much.. that was so helpful . But , I have a problem when in text file i use a font and run your code in my program, At the first ,the font get back to that former font and after that , i mean for the second time pressing the button, It start to fade in.. I think it has a problem for running with font in txt file.

  • Deepak

    Tnk u bro 🙂

  • Aqeel Tamimi

    Thank you very much. It is valuable and helpful. Shokran شكرا

  • Raju Thomas

    Hi Ravi,
    While using the rotation animation, i seems like lagging. Can’t feel it as continuous rotation. I tried adjusting duration, interpolator . But still the same.. How to make it feel like continuous rotation without lag?

    • Hi Raju

      Explore about material design animations.

  • Neha Sharma

    Sir , can you provide lessons on animation with layout ?
    Is it possible to make our app look like ios apps(with the help of animations)?

  • apchar

    cat you just give us a simple download link? I’m not handing out access to my social accounts. That’s insane.

  • Alex Mugo

    This is great! now I have understood animations.

  • Devesh Vyas

    Hi Ravi,
    Another Great tutorial, I have followed almost all the tutorials of yours and they helped me a mot iin learning android. I am moving into AR/VR space, do you have any tutorials for Android VR using VR SDK or Cardboard SDK. I am really looking forward for such tutorials.

    • Sorry, I don’t have any related to VR. I prepare Wikitude but it is not published yet.

  • Hell strikes

    Hi,
    I am new to android development .Can you please tell me how to create the following color effect on a button(when it’s clicked)?

    Thanks a lot.
    https://www.dropbox.com/sh/myce7icdcqyjii4/AAAjDBBeX513lgJxf4JRvzw2a?dl=0

  • kapila Rathnayaka

    AlphaAnimation anim = new AlphaAnimation(1.0f, 0.0f);
    anim.setDuration(1000);
    anim.setRepeatCount(INFINITE);
    anim.setRepeatMode(Animation.REVERSE);
    button.startAnimation(anim);

    I am using something like this and the images on screen disappeared after some time I start to run the activity, When we set the anim.setRepeatCount(INFINITE); to anim.setRepeatCount(0); the images on screen does not disappear. Is there any relation in between repeat count and image visibility. It is not the image animating is disappearing. It is another image on the screen get disappeared when we touch them.

  • NaveenReddy N

    Hi Ravi,
    I have followed almost all the tutorials of yours and they helped me a mot in learning android.
    In my app i need to disappeared the image with Vanish animation effect like the below link. Please help me if there is any possibility.Thanks in Advance…

    https://site.uplabs.com/posts/final-web-interactions-wip

  • parkwow

    thanks, this is helpful information~ 🙂

  • SemyColon

    i was very Confused … until i read this post … Thanks Ravi

  • Champak Lal

    Very useful tutorial.
    But what if we want to do some simple animation like rolling a dice as done in this app –
    https://play.google.com/store/apps/details?id=developer.android.vd.diceroller

  • Prarthana

    Thanks a lot sir !!

  • bosssrini

    one of worst tutorials i have seen

    • sivaen

      ya same

  • sivanrupan

    waste of time in reading this

  • Lissi

    hey
    for me the txtMessage in the command findViewByIt(R.id.txtxMessage) canÄt be resolved. can anyone help me with that?