【问题标题】:How to create bundle in android with both extras and transitions如何在 android 中创建具有附加功能和过渡的捆绑包
【发布时间】:2020-01-19 17:55:13
【问题描述】:

我正在尝试开始一个具有这种风格的新活动:

<style name="SecondActivityStyle" parent="SomeParent">
        <item name="android:windowActivityTransitions" tools:targetApi="lollipop">true</item>
        <item name="android:windowEnterTransition" tools:targetApi="lollipop">@transition/explode</item>
        <item name="android:windowExitTransition" tools:targetApi="lollipop">@transition/explode</item>
</style>

但问题是,我已经发送了包含一些字符串的捆绑包,所以我现在正尝试以这种方式创建捆绑包:

if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
    extras = ActivityOptions.makeSceneTransitionAnimation(this).toBundle();
}

extras.putSerializable("user", user);
extras.putString("feedName", feedName);

final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(deepLink));
intent.putExtras(extras);
startActivityForResult(intent, 1);

但我总是得到默认过渡而不是“爆炸”过渡。捆绑包中的附加功能有问题吗?

【问题讨论】:

    标签: java android xml animation transition


    【解决方案1】:

    当然,bundle 没有问题。请参阅以下答案以编程方式将转换应用于活动 How to achieve right to left animation to start the activity

    【讨论】:

      猜你喜欢
      • 2022-06-30
      • 2011-03-06
      • 2020-11-25
      • 1970-01-01
      • 2012-03-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多