缩放动画在Android 5 Lollipop中无效

时间:2015-02-16 16:34:12

标签: android android-animation

我有一个Activity有一个处理程序。处理程序执行一些工作然后向另一个Activity启动一个intent。我在启动意图后使用overridePendingTransition并致电finish()

在Android 4.2中,缩放动画工作正常但在android 5中却没有。

关于动画我需要了解的两个Android版本之间是否有任何差异?

public void initHandler(){

      handler = new Handler();
      runnable = new Runnable() {
            public void run() {
                processTag();

            }

            private void processTag() {
                Log.e(TAG, "about to process tag");

                .....
                process some info
                .......


                                handler.post(new Runnable(){
                                    public void run() {

                                        setContentView(R.layout.successfulnfc);

                                      }
                                    });


                            Intent processPayloadIntent = new Intent(NfcActivity.this, NfcscannerActivity.class);
                            processPayloadIntent.putExtra("payload", payload);
                            processPayloadIntent.putExtra("tagid", tagId);
                            processPayloadIntent.setAction("NFC"); 
                            processPayloadIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                            //processPayloadIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP|Intent.FLAG_ACTIVITY_NEW_TASK);
                            startActivity(processPayloadIntent);
                            finish();
                            overridePendingTransition(0, R.anim.activity_animation_zoom_in);





            }
        };

    }

...

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

    <scale
        android:duration="2000"
        android:fillAfter="false"
        android:fromXScale="1.0"
        android:fromYScale="1.0"
        android:interpolator="@android:anim/linear_interpolator"
        android:pivotX="50%"
        android:pivotY="50%"
        android:startOffset="0"
        android:toXScale="0.55"
        android:toYScale="0.55" />

</set>

0 个答案:

没有答案