FileDocCategorySizeDatePackage
CrossFadeDemo.javaAPI DocAndroid 5.1 API2523Thu Mar 12 22:22:44 GMT 2015com.android.transitiontests

CrossFadeDemo

public class CrossFadeDemo extends android.app.Activity

Fields Summary
android.view.ViewGroup
mSceneRoot
static int
mCurrentScene
android.transition.Scene
mScene1
android.transition.Scene
mScene2
android.transition.TransitionManager
mTransitionManager
Constructors Summary
Methods Summary
public voidonCreate(android.os.Bundle savedInstanceState)

        super.onCreate(savedInstanceState);
        setContentView(R.layout.crossfade);

        View container = (View) findViewById(R.id.container);
        mSceneRoot = (ViewGroup) container.getParent();

        mScene1 = Scene.getSceneForLayout(mSceneRoot, R.layout.crossfade, this);
        mScene2 = Scene.getSceneForLayout(mSceneRoot, R.layout.crossfade_1, this);

        Crossfade crossfade = new Crossfade();
        crossfade.setFadeBehavior(Crossfade.FADE_BEHAVIOR_CROSSFADE);
        crossfade.setResizeBehavior(Crossfade.RESIZE_BEHAVIOR_NONE);
        crossfade.addTarget(R.id.textview).addTarget(R.id.textview1).
                addTarget(R.id.textview2);
        mTransitionManager = new TransitionManager();
        TransitionSet moveCrossFade = new TransitionSet();
        moveCrossFade.addTransition(crossfade).addTransition(new ChangeBounds());
        mTransitionManager.setTransition(mScene1, moveCrossFade);
        mTransitionManager.setTransition(mScene2, moveCrossFade);
        mCurrentScene = 1;
    
public voidsendMessage(android.view.View view)

        if (mCurrentScene == 1) {
            mTransitionManager.transitionTo(mScene2);
            mCurrentScene = 2;
        } else {
            mTransitionManager.transitionTo(mScene1);
            mCurrentScene = 1;
        }