Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List of android view transition animations?

Is there a list of all the animations that I can use to transition between two views? I.e. zoom, slide, face, etc.

I cannot seem to find a comprehensive list, neither in the SDK nor by searching Google.

In addition, is there any demo app that will show all of them, such that I can evaluate which would look best for a specific use case?

like image 982
Bjarke Freund-Hansen Avatar asked Oct 09 '22 11:10

Bjarke Freund-Hansen


2 Answers

The comprehensive list of animations is not possible to be created. Your imagination is the limit to the number of possible animations.

You can use any combination of the basic animations available(alpha, scale, translate and rotate) to transit between two views. This might help you.

like image 150
500865 Avatar answered Oct 13 '22 12:10

500865


There are many options make animation between views some of are the basic one like alpha, scale, translate and rotate also there new this introduced in the material design concept for view transitions

here you can find sample code the material design git reference for view animation https://github.com/lgvalle/Material-Animations

You can also apply other animation using anim resource

here is activity code you have to write

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.splashscreen);

     new Handler().postDelayed(new Runnable() {
         public void run() {

                 /* Create an intent that will start the main activity. */
                 Intent mainIntent = new Intent(SplashScreen.this,
                         ConnectedActivity.class);
                 mainIntent.putExtra("id", "1");

                 //SplashScreen.this.startActivity(mainIntent);
                 startActivity(mainIntent);
                 /* Finish splash activity so user cant go back to it. */
                 SplashScreen.this.finish();

                 /* Apply our splash exit (fade out) and main
                    entry (fade in) animation transitions. */
                 overridePendingTransition(R.anim.mainfadein,R.anim.splashfadeout);
         }
 }, SPLASH_DISPLAY_TIME);   
}

Add this two file in res/anim folder.

slide_in.xml

 <?xml version="1.0" encoding="utf-8"?>
        <translate 
              xmlns:android="http://schemas.android.com/apk/res/android"
              android:duration="@android:integer/config_longAnimTime" 
              android:fromXDelta="100%p" 
              android:toXDelta="0%p">
        </translate>

slide_out.xml

 <?xml version="1.0" encoding="utf-8"?>
       <translate
             xmlns:android="http://schemas.android.com/apk/res/android" 
             android:duration="@android:integer/config_longAnimTime" 
             android:fromXDelta="0%p" 
             android:toXDelta="-100%p">
      </translate>

I hope this will be solve your queries

like image 25
Navin Avatar answered Oct 13 '22 12:10

Navin