android - 为新 Activity 添加动画

标签 android transactions android-activity android-animation

我正在尝试在 activitis 之间添加一个过渡,但没有用。

我一直在寻找并修复它,但没有一个答案对我有用。

喜欢:

overridePendingTransition not working

Can I change the Android startActivity() transition animation?

Make new activity appear behind old one during transition

我发布我的代码:

在带有一个按钮的 MainActivity 中,我设置了 onclick 监听器。

    cobrar.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent formasdepago = new Intent(MainActivity.this, Formas_De_Pago.class);
            startActivity(formasdepago);
            overridePendingTransition(R.anim.push_in,R.anim.push_out);
        }
    });

插入.xml

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

Push_out.xml

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

最佳答案

问题出在我的手机上,我禁用了这个选项:

设置->开发者选项->过渡动画比例

关于android - 为新 Activity 添加动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23134902/

相关文章:

mysql - 根据计数限制插入

java - Spring:注解驱动的事务管理器

java - 跨 Activity 传递信息的问题

Android::视频内容的 DRM

android - AlphaAnimation 对象不会更改动画 View 的 alpha 属性,为什么?

android - AlertDialog 主题不工作

mysql - 两个事务似乎互相阻塞,但没有一个在等待

java - 循环 AsyncTask 以获取 JSON 并将其作为对象存储在同一列表中

Android setContentView(View) 抛出与appcompat-7库相关的NullPointerException

java - 我如何收听 Android 的联系人启动 Activity ?