gpt4 book ai didi

Android Activity Transitions + Animation 显示加载的 Activity

转载 作者:行者123 更新时间:2023-11-29 00:10:11 25 4
gpt4 key购买 nike

使用 overridePendingTransition 方法,我如何将当前(完成的) Activity 向下移动并移开,显示其背后新加载的 (startActivity) Activity ?

slide_out_bottom.xml:

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@anim/full_screen_modal_decelerate_interpolator">
<translate android:fromYDelta="0%" android:toYDelta="100%" android:fillAfter="true"
android:duration="300"/>
</set>

点击:

 @Override
public void onClick(View v) {
finish();
Intent intent = new Intent(context, TestActivity.class);
startActivity(intent);
overridePendingTransition(0, R.anim.slide_out_bottom);
}

最佳答案

使用 zAdjustment 使现有 Activity 位于顶部:

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@anim/full_screen_modal_decelerate_interpolator"
android:zAdjustment="top">
<translate
android:fromYDelta="0%"
android:toYDelta="100%"
android:duration="300"/>
</set>

关于Android Activity Transitions + Animation 显示加载的 Activity ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30875721/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com