如何在不属于我的应用的活动上应用结束转换。说,我正在打开联系人应用以选择联系人,我在打开联系人应用时应用向上滑动转换,但关闭应用应用默认动画(向左滑动)。
是否有可能在关闭时设置动画?
答案 0 :(得分:12)
我假设当你开始另一个应用程序的活动时(在这个例子中它是Contacts应用程序),你在动画的活动中使用overridePendingTransition()
,如下所示:
Intent intent= new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI);
startActivityForResult(intent, requestCode);
overridePendingTransition(R.anim.slide_in_right_to_left, android.R.anim.fade_out);
在您的活动的onResume()
方法中,您还可以使用overridePendingTransition()
为您返回的活动(来自“通讯录”应用)制作动画:
@Override
protected void onResume() {
overridePendingTransition(0, android.R.anim.slide_out_right);
super.onResume();
}