Skip to main content

Posts

Showing posts from January, 2015

Android Animations in Android 5.0 / AppCompat

View Animation View animation has never been more fun in Android 4 and above. With Android 5.0 Lollipop, more fun animations can be done by using the ActivityOptions or ActivityOptionsCompat (in AppCompat). ViewCompat allows you to animate all sorts of animation types with start delays and other neat stuff. One example that returns a ViewPropertyAnimatorCompat object.  ViewCompat.animate(view).setDuration(1000).scaleYBy(1).scaleXBy(1).start(); View Elevation We all know that setting elevation is not possible in Android 4.+. You can either apply your own drawable shadow to simulate that effect, or you can use the support library to do the following: ViewCompat.setElevation(getResources().getDimensionPixelSize(R.dimen.drawable_elevation)); Activity Transitions If you wanna animate an item only for the activity transition, a. In Activity A, ActivityOptionsCompat options =                 ActivityOptionsCompat.makeSceneTransitionAnimation(context,