【问题标题】:Android Activity Transitions + Animation to reveal loaded activityAndroid Activity Transitions + Animation 显示加载的活动
【发布时间】:2015-06-17 08:06:13
【问题描述】:

使用 overridePendingTransition 方法,我如何将当前(已完成)的活动动画化,并显示其背后新加载的 (startActivity) 活动?

slide_out_bottom.xml:

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

点击:

 @Override
    public void onClick(View v) {
        finish();
        Intent intent = new Intent(context, TestActivity.class);          
        startActivity(intent);
        overridePendingTransition(0, R.anim.slide_out_bottom);
    }

【问题讨论】:

    标签: android


    【解决方案1】:

    使用zAdjustment 使现有活动位于顶部:

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

    【讨论】:

    猜你喜欢
    • 2016-07-05
    • 2014-04-02
    • 1970-01-01
    • 1970-01-01
    • 2019-07-30
    • 1970-01-01
    • 2011-06-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多