overridePendingTransition behaiving different with

2019-07-03 16:44发布

I am using a slide in animation to open activities in my app by using overridePendingTransition. Earlier when i used it after startActivity(intent) withiout intent flags , it was working fine. With intent flags it was not working so i used overridePendingTransition in onResume() method now when the activity is started for the first time the animation is fine but when the same instance is brought to front because of intent flag the animation is working but its not smooth . The second time the activity start from right to slide in(which is correct) but it appears with jerk.

These are the intent flags i am using

intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);

What should be done to solve this.Help Plz

This is the code i use for slide in animation i.e enter_anim

<translate
    android:duration="200"
    android:fromXDelta="100%"
    android:fromYDelta="0%"
    android:toXDelta="0%"
    android:toYDelta="0%" />

since i dont wanna give any exit_anim

<translate
    android:duration="200"
    android:fromXDelta="0%"
    android:fromYDelta="0%"
    android:toXDelta="0%"
    android:toYDelta="0%" />

2条回答
Deceive 欺骗
2楼-- · 2019-07-03 17:22

So try below code in your manifest:- in application add this

 android:hardwareAccelerated="true"
查看更多
ゆ 、 Hurt°
3楼-- · 2019-07-03 17:33

try the following code

overridePendingTransition(R.anim.slide_in_left_first,
                        R.anim.slide_out_left_first);
slide_in_left_first:-

<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="200"
    android:fromXDelta="100%p"
    android:toXDelta="0%p" />

slide_out_left_first:-

<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
        android:duration="200"

    android:fromXDelta="0%"

    android:toXDelta="0%" />
查看更多
登录 后发表回答