overridePendingTransition behaiving意图不同的标志 [英] overridePendingTransition behaiving different with intent flags

查看:118
本文介绍了overridePendingTransition behaiving意图不同的标志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用动画的幻灯片使用overridePendingTransition打开我的应用程序的活动。早些时候,当我startActivity(意向)withiout意图后标志使用它,这是工作的罚款。意图标志它不工作,所以我用overridePendingTransition在onResume()方法现在,当活动开始的第一次动画是好的,但是当同一个实例被带到前面,因为意图标志的动画工作,但它不是流畅。第二次活动从右侧开始滑入(这是正确的),但它与挺举出现。

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);

应该做些什么来解决this.Help PLZ

What should be done to solve this.Help Plz

这是code I在动画即enter_anim使用幻灯片
    

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%" />

因为我不想给任何exit_anim

since i dont wanna give any exit_anim

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

推荐答案

请尝试以下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%" />

这篇关于overridePendingTransition behaiving意图不同的标志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆