You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Android:TransitionManager.beginDelayedTransition为何不支持MaterialSharedAxis?

Why isn't TransitionManager.beginDelayedTransition accepting MaterialSharedAxis as a parameter?

Hey, let's break down why you're hitting this issue and walk through the fixes:

1. You're probably importing the wrong TransitionManager package

There are two distinct versions of TransitionManager in Android:

  • The old platform implementation: android.transition.TransitionManager, which expects an android.transition.Transition parameter
  • The AndroidX implementation: androidx.transition.TransitionManager, which works with androidx.transition.Transition

Your MaterialSharedAxis comes from com.google.android.material.transition.MaterialSharedAxis, which is built on top of the AndroidX Transition class. If you've imported the old platform TransitionManager, the IDE will flag a type mismatch because the two aren't compatible.

Fix: Double-check your imports and make sure you're using the AndroidX version:

import androidx.transition.TransitionManager

2. API mismatches in your Material Components version

You're using com.google.android.material:material:1.2.0-rc01—this is an older release candidate version, where there might have been lag between the documentation and the actual API implementation. While MaterialSharedAxis does inherit from Transition in this version, there could be hidden compatibility quirks that cause the parameter mismatch error.

Fix: Upgrade to a newer, stable version of Material Components. Versions 1.4.0 and above have better API consistency and bug fixes. Update your app-level build.gradle dependency:

implementation "com.google.android.material:material:1.4.0"
// Or use the latest stable version available

Quick sanity check

Ensure you're importing the correct MaterialSharedAxis too:

import com.google.android.material.transition.MaterialSharedAxis

After making these changes, TransitionManager.beginDelayedTransition(container, sharedAxis) should compile and work as expected.

内容的提问来源于stack exchange,提问作者hamthenormal

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.08 14:13:12