Thursday, April 18, 2013

Android Button Animation Example

The Android Development Tutorials blog contains Basic as well as Advanced android tutorials.Go to Android Development Tutorials to get list of all Android Tutorials.

How To Animate a Button

We need a xml file that will define the Animation.

Create a folder named  "anim"  in res folder

Create a xml file named vanish.xml,  in this file we will define our Animation.


<set xmlns:android="" >
<scale android:duration="300"     // duration in miliseconds
       android:fromXScale="1.0"    //  X scaling to start from
       android:fromYScale="1.0"    // Y scaling to start from

<alpha android:duration="300"

In your Activity class create the reference of the Button on which you want apply the animation.

Animation vanish =AnimationUtils.loadAnimation(this,R.anim.vanish);

You can change the following attributes acoording your requirement


Android Animation Examples:

Animating  ImageViews

Layout Animations
Sliding Between Screen  Using ViewFlipper

More Android Topics

New Advance Topics:
Android ImageSwitcher                    Android TextSwitcher                                Android ViewFlipper
Android Gesture Detector               Handling/Detecting Swap Events                Gradient Drawable
Detecting Missed Calls                    Hide Title Bar                                           GridView Animation

 Beginning With Android
      Android : Introduction                                                              Configuring Eclipse for Android Development
     Creating Your First Android Project                                           Understanding Android Manifest File of your android app

 Advance Android Topics                                                              Customizing Android Views

Working With Layouts                                                                Working With Views

Understanding Layouts in Android                                                   Using Buttons and EditText in Android
Working with Linear Layout (With Example)                                     Using CheckBoxes in Android
Nested Linear Layout (With Example)                                              Using AutoCompleteTextView in Android                                                                                          Grid View
Relative Layout In Android                                                               ListView
Table Layout                                                                                   Android ProgressBar
Frame Layout(With Example)                                                          Customizing ProgressBar
Absolute Layout                                                                             Customizing Radio Buttons
Grid Layout                                                                                    Customizing Checkboxes In Android

Android Components                                                                 Dialogs In Android

Activity In Android                                                                    Working With Alert Dialog
Activity Life Cycle                                                                    Adding Radio Buttons In Dialog
Starting Activity For Result                                                       Adding Check Boxes In Dialog
Sending Data from One Activity to Other in Android                    Creating Customized Dialogs in Android
Returning Result from Activity                                                   Creating Dialog To Collect User Input
Android : Service                                                                     DatePicker and TimePickerDialog
BroadcastReceiver                                                                   Using TimePickerDialog and DatePickerDialog In android

Menus In Android                                                                ListView:
Creating Option Menu                                                               Populating ListView With DataBase
Creating Context Menu In Android                                              Populating ListView with ArrayList
                                                                                               ListView with Custom Adapter

Toast                                                                                      Working With SMS
Customizing Toast In Android                                                       How to Send SMS in Android
Customizing the Display Time of Toast                                        How To Receive SMS
Customizing Toast At Runtime                                                  Accessing Inbox In Android
Adding Image in Toast
Showing Toast for Longer Time

TelephonyManager                                                            Storage: Storing Data In Android
Using Telephony Manager In Android                                          SharedPreferences In Android
                                                                                              Reading and Writing files to Internal Stoarage
Working With Incoming Calls                                             DataBase
How To Handle Incoming Calls in Android                                Working With Database in Android
How to Forward an Incoming Call In Android                            Creating Table In Android
CALL States In Android                                                          Inserting, Deleting and Updating Records In Table in Android

Notifications In Android
How To Vibrate The Android Phone
Sending Email In Android
Opening a webpage In Browser
How to Access PhoneBook In Android
Prompt User Input with an AlertDialog


  1. i want to create 3d live wallpaper in which there is day and night detector,talking digital clock and also talking battery warning,can anyone help me its my project?i am new to developing

  2. great :)
    it is very helpful ,we can save our course fee by doing it .great site.

  3. it was very informative information for me, thanks for post.

  4. Its very informative. I was searching it from some time.

    [url=] Professional web design company[/url]

  5. good information. Thanks for such post

  6. Thanks it enhanced my knowledge.

  7. you always write informative notes.

  8. very nice information thanks for the post.

  9. I like your post thanks for the information.

  10. you write a nice information thanks.

  11. Drawing a toon me face of somebody is still my greatest test following quite a while of preparing and a few workmanship classes. I now and again get baffled drawing someones eyes since they are the most hard to draw and can take hours of practice. Check This Out

  12. Enjoyed reading the article above , really explains everything in detail,the article is very interesting and effective. Thank you and good luck for the upcoming articles...For more please visit: Android App Development USA