Example usage for android.transition Scene Scene

List of usage examples for android.transition Scene Scene

Introduction

In this page you can find the example usage for android.transition Scene Scene.

Prototype

public Scene(ViewGroup sceneRoot) 

Source Link

Document

Constructs a Scene with no information about how values will change when this scene is applied.

Usage

From source file:MainActivity.java

public void goAnimate(View view) {

    ViewGroup root = (ViewGroup) findViewById(R.id.layout);
    Scene scene = new Scene(root);

    Transition transition = new ChangeBounds();
    TransitionManager.beginDelayedTransition(root, transition);

    TextView textViewTop = (TextView) findViewById(R.id.textViewTop);
    RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) textViewTop.getLayoutParams();
    params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, 1);
    params.addRule(RelativeLayout.ALIGN_PARENT_TOP, 0);
    textViewTop.setLayoutParams(params);

    TextView textViewBottom = (TextView) findViewById(R.id.textViewBottom);
    params = (RelativeLayout.LayoutParams) textViewBottom.getLayoutParams();
    params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, 0);
    params.addRule(RelativeLayout.ALIGN_PARENT_TOP, 1);
    textViewBottom.setLayoutParams(params);

    TransitionManager.go(scene);// www.  j  av a 2s . com

}