如何设置辅助 android activity 打开的动画?就像在 Playstore 上的新闻一样

How can I animate the opening of a secondary android activity? as on playstore news

虽然我确实知道如何很容易地打开另一个 activity,但使用如下所示的意图:

Intent intent = new Intent(first.this, second.class);                                   intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
intent.putExtra("selectedApp", ApplicationTitle.getText());
startActivity(intent);

当您使用 android 应用程序 "PlayStore News" 时,当您 select 一条新闻而不是仅仅被重定向到另一个 activity。出现动画,其中几张小卡片变为一张大卡片。

我怎样才能做到这一点?

您可能想看看 https://developer.android.com/training/material/animations.html#Transitions

这解释了如何定义活动之间的自定义转换。特别是,您可能对共享元素转换感兴趣。我会更具体,但这是一个相当广泛的问题

http://www.mysamplecode.com/2013/02/android-animation-switching-activity.html

有一个方法

 overridePendingTransition(R.anim.push_up_in, R.anim.push_up_out);

在 android 中切换活动时检查动画示例代码。

http://android-er.blogspot.in/2013/04/custom-animation-while-switching.html http://www.mysamplecode.com/2013/02/android-animation-switching-activity.html