Skip to content
xiaojinzi123 edited this page Jun 29, 2020 · 2 revisions

原生使用动画分为两种方式.

  • overridePendingTransition()
  • startActivity(Intent intent, Bundle options) 带有 options 参数的

当你使用了 Component 的 Router, 使用的方式得变一变. 第一种实现如下, 利用 afterStartAction

Router
                .with(this)
                .host(ModuleConfig.Help.NAME)
                .path(ModuleConfig.Help.TEST_WEB_ROUTER)
                .afterStartAction(() -> {
                    overridePendingTransition(
                            android.R.anim.fade_in,
                            android.R.anim.fade_out
                    );
                })
                .forward();

第二种实现如下, 利用 options 方法:

Router
                .with(this)
                .host(ModuleConfig.Help.NAME)
                .path(ModuleConfig.Help.TEST_WEB_ROUTER)
                .options(这里是你动画的 options)
                .forward();
Clone this wiki locally