Skip to content

Instantly share code, notes, and snippets.

@d4rkc0de
Created February 11, 2017 10:49
Show Gist options
  • Save d4rkc0de/d339c37a267c4cfd6d635bb032fe18a3 to your computer and use it in GitHub Desktop.
Save d4rkc0de/d339c37a267c4cfd6d635bb032fe18a3 to your computer and use it in GitHub Desktop.
Scene : elevate from bottom to top
// java
private Scene mSceneMain;
LinearLayout container = (LinearLayout) findViewById(R.id.container);
mSceneMain = Scene.getSceneForLayout(container, R.layout.scene_main, this);
container.postDelayed(new Runnable() {
@Override
public void run() {
TransitionManager.go(mSceneMain, new ChangeBounds().setDuration(500).setInterpolator(new DecelerateInterpolator()));
}
}, 1000);
// xml
// main
<RelativeLayout
android:id="@+id/rlt_bg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorBg">
<TextView
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:textColor="#FFF"
android:id="@+id/textView"
android:text="TextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout>
// second layout
<android.support.v7.widget.Toolbar
android:id="@+id/rlt_bg"
android:layout_width="match_parent"
android:layout_height="@dimen/bar_height"
android:background="@color/colorBg">
</android.support.v7.widget.Toolbar>
<android.support.v7.widget.RecyclerView
android:id="@+id/rv_common"
android:layout_below="@+id/rlt_bg"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
// Make sure rlt_bg are same for both scene shared views
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment