fragment animations

satya - Tuesday, November 08, 2011 12:55:50 PM

see the note on property animations

see the note on property animations

satya - Tuesday, November 08, 2011 12:56:44 PM

Understand fragments

Understand fragments

satya - Tuesday, November 08, 2011 12:58:08 PM

Setting a transition


ft.setTransition(
  FragmentTransaction.TRANSIT_FRAGMENT_FADE);

satya - Tuesday, November 08, 2011 12:58:21 PM

see the api for other transitions

see the api for other transitions

satya - Tuesday, November 08, 2011 1:00:22 PM

useful ones


transit_fragment_fade
transit_fragment_none

satya - Tuesday, November 08, 2011 1:01:51 PM

Here is a custom transition


ft.setCustomAnimations(
  android.R.animator.fade_in, 
  android.R.animator.fade_out);

You can discover other animations by using eclipse and doing

android.R.animator.

satya - Tuesday, November 08, 2011 1:06:15 PM

where else can I find these stock animators


under the sdk
/data/res/animator

satya - Tuesday, November 08, 2011 1:06:37 PM

an example: slide_in_left.xml


<?xml version="1.0" encoding="utf-8" ?>
<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
    android:interpolator="@android:interpolator/accelerate_decelerate"
    android:valueFrom="-1280"
    android:valueTo="0"
    android:valueType="floatType"
    android:propertyName="x"
    android:duration="2000" />

satya - Tuesday, November 08, 2011 1:08:17 PM

Here is how to combine a set of animators:slide_out_down.xml


<?xml version="1.0" encoding="utf-8" ?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<objectAnimator
    android:interpolator="@android:interpolator/accelerate_cubic"
    android:valueFrom="0"
    android:valueTo="1280"
    android:valueType="floatType"
    android:propertyName="y"
    android:duration="2000" />
<objectAnimator
    android:interpolator="@android:interpolator/accelerate_cubic"
    android:valueFrom="1"
    android:valueTo="0"
    android:valueType="floatType"
    android:propertyName="alpha"
    android:duration="2000" />
</set>