我试图在活动组之间添加一个转换,但不起作用。将动画添加到新活动
我一直在寻找和解决它,但没有答案为我工作。
像:
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);
}
});
Push_in.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/linear_interpolator">
<translate android:fromYDelta="100%p" android:toYDelta="0" android:duration="500"/> </set>
Push_out.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/linear_interpolator">
<translate android:fromYDelta="0" android:toYDelta="-100%p" android:duration="500"/> </set>
您是否想在每次活动开始时或刚刚从某些地方调用时动画?如果每次都将您的'overridePendingTransition'放入正在启动的Activity的onCreate中。 – dharms
我想在每次点击按钮“cobrar”时制作动画。 – Rogui
我想在onCreate中放置overridePendingTransaction! – Rogui