How do I expand CardViews to show more detail like Google Keep cards?

六眼飞鱼酱① 提交于 2019-11-30 00:00:21

New in Lollipop!

Activity + Fragment Transitions

By declaring "shared elements" that are common across two screens you can create a smooth transition between the two states.

album_grid.xml:

<ImageView
    …
    android:transitionName="@string/transition_album_cover" />

album_details.xml:

<ImageView
    …
    android:transitionName="@string/transition_album_cover" />

Java:

AlbumActivity.java
Intent intent = new Intent();
String transitionName = getString(R.string.transition_album_cover);
…
ActivityOptionsCompat options =
ActivityOptionsCompat.makeSceneTransitionAnimation(activity,
    albumCoverImageView,   // The view which starts the transition
    transitionName    // The transitionName of the view we’re transitioning to
    );
ActivityCompat.startActivity(activity, intent, options.toBundle());

Here we define the same transitionName in two screens. When starting the new Activity and this transition is animated automatically. In addition to shared elements, you can now also choreograph entering and exiting elements.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!