ConstraintLayout
此表列出了 androidx.constraintlayout
组中的所有工件。
工件 | 稳定版 | 发布候选版 | Beta 版 | Alpha 版 |
---|---|---|---|---|
constraintlayout | 2.2.1 | - | - | - |
constraintlayout-compose | 1.1.1 | - | - | - |
constraintlayout-core | 1.1.1 | - | - | - |
声明依赖项
要添加对 ConstraintLayout 的依赖项,您必须将 Google Maven 存储库添加到您的项目中。阅读Google 的 Maven 存储库以获取更多信息。
在应用或模块的 build.gradle
文件中添加您所需的工件依赖项
Groovy
dependencies { implementation "androidx.constraintlayout:constraintlayout:2.2.1" // To use constraintlayout in compose implementation "androidx.constraintlayout:constraintlayout-compose:1.1.1" }
Kotlin
dependencies { implementation("androidx.constraintlayout:constraintlayout:2.2.1") // To use constraintlayout in compose implementation("androidx.constraintlayout:constraintlayout-compose:1.1.1") }
有关依赖项的更多信息,请参阅添加构建依赖项。
反馈
您的反馈有助于改进 Jetpack。如果您发现新问题或有改进此库的想法,请告诉我们。在创建新问题之前,请查看此库中现有问题。您可以通过点击星形按钮为您关注的问题投票。
有关更多信息,请参阅问题跟踪器文档。
ConstraintLayout-compose 和 ConstraintLayout-Core 1.1
版本 1.1.1
2025 年 2 月 26 日
androidx.constraintlayout:constraintlayout-compose:1.1.1
、androidx.constraintlayout:constraintlayout-compose-android:1.1.1
和 androidx.constraintlayout:constraintlayout-core:1.1.1
已发布。版本 1.1.1 包含这些提交。
Bug 修复
- 修复了一些布局问题,这些问题在某些情况下会导致布局无法放置,例如切换可见性。(I34e68,b/299134793)
版本 1.1.0
2024 年 10 月 30 日
androidx.constraintlayout:constraintlayout-compose:1.1.0
、androidx.constraintlayout:constraintlayout-compose-android:1.1.0
和 androidx.constraintlayout:constraintlayout-core:1.1.0
已发布。版本 1.1.0 包含这些提交。
自 1.0.0 以来的重要变更
- 修复了与 SharedTransitionLayout 的交互问题 (b/332898040)。
- 修复了由于重组导致的与测量相关的布局问题 (b/219091179, Ibfe8a)。
版本 1.1.0-rc01
2024 年 10 月 16 日
androidx.constraintlayout:constraintlayout-compose:1.1.0-rc01
、androidx.constraintlayout:constraintlayout-compose-android:1.1.0-rc01
和 androidx.constraintlayout:constraintlayout-core:1.1.0-rc01
已发布。版本 1.1.0-rc01 包含这些提交。
版本 1.1.0-beta01
2024 年 9 月 4 日
androidx.constraintlayout:constraintlayout-compose:1.1.0-beta01
、androidx.constraintlayout:constraintlayout-compose-android:1.1.0-beta01
和 androidx.constraintlayout:constraintlayout-core:1.1.0-beta01
已发布。版本 1.1.0-beta01 包含这些提交。
版本 1.1.0-alpha14
2024 年 8 月 7 日
androidx.constraintlayout:constraintlayout-compose:1.1.0-alpha14
、androidx.constraintlayout:constraintlayout-compose-android:1.1.0-alpha14
和 androidx.constraintlayout:constraintlayout-core:1.1.0-alpha14
已发布。版本 1.1.0-alpha14 包含这些提交。
API 变更
- 标志现在通过伴生对象单独提供,并可与
or
运算符组合。(I9df53) - 简化了
createRow
和createColumn
辅助函数。改进了createGrid
参数名称和文档以供澄清。(Iebc92) - 简化了
ConstraintLayout
中的animateChanges
API,现在只需要一个非空AnimationSpec
。InvalidationStrategy
中的onIncomingConstraints
现在是一个常规 lambda。fixedWidthRate
重命名为shouldInvalidateOnFixedWith
,高度变量也一样。(Ie59cd,b/332898040,b/336370035) NestedScroll
来源 Drag 和 Fling 正在被UserInput
和SideEffect
替代,以适应这些来源的扩展定义,现在包括动画 (Side Effect) 和鼠标滚轮和键盘 (UserInput)。(I40579)
版本 1.1.0-alpha13
2023 年 10 月 4 日
androidx.constraintlayout:constraintlayout-compose:1.1.0-alpha13
、androidx.constraintlayout:constraintlayout-compose-android:1.1.0-alpha13
和 androidx.constraintlayout:constraintlayout-core:1.1.0-alpha13
已发布,无任何变更。版本 1.1.0-alpha13 包含这些提交。
- 此版本允许
androidx.constraintlayout
库与最新的 Compose 发布版 ABI 兼容。
版本 1.1.0-alpha12
2023 年 8 月 9 日
androidx.constraintlayout:constraintlayout-compose:1.1.0-alpha12
、androidx.constraintlayout:constraintlayout-compose-android:1.1.0-alpha12
和 androidx.constraintlayout:constraintlayout-core:1.1.0-alpha12
已发布。版本 1.1.0-alpha12 包含这些提交。
API 变更
- 已将
LayoutScopeMarker
添加到 Transition DSL。(If54ce)
版本 1.1.0-alpha11
2023 年 7 月 26 日
androidx.constraintlayout:constraintlayout-compose:1.1.0-alpha11
、androidx.constraintlayout:constraintlayout-compose-android:1.1.0-alpha11
和 androidx.constraintlayout:constraintlayout-core:1.1.0-alpha11
已发布。版本 1.1.0-alpha11 包含这些提交。
新功能
- 您现在可以提供一个
InvalidationStrategy
来优化MotionLayout
中的无效化,这通常会降低性能。(Iada0c) - 在使用
ConstraintLayout
与内联 Modifier DSL (Modifier.constrainAs
) 时,您现在可以使用animateChanges = true
,每当约束 DSL 发生变化时,ConstraintLayout
将自动动画到新状态。(I9abf1) - 为 OnSwipe 启用了
limitBoundsTo
功能。(I56522)
API 变更
- 将
TransitionScope.staggered
重命名为TransitionScope.maxStaggerDelay
。(I0fd2d)
Bug 修复
- 修复了
OnSwipe
中的dragScale
参数不工作的问题。(8bef26) - 修复了
MotionScene
中的customColor
与透明颜色不正常工作的问题。(81b2ac) - 修复了
OnSwipe
停止时未正确通知的问题,同时修复了touchUp
的初始速度计算问题。(Ia5f6f) - 更新了
ConstraintLayout
Composable 和Constraintset
的 KDoc。(3bfe63)
版本 1.1.0-alpha10
2023 年 5 月 24 日
androidx.constraintlayout:constraintlayout-compose:1.1.0-alpha10
、androidx.constraintlayout:constraintlayout-compose-android:1.1.0-alpha10
和 androidx.constraintlayout:constraintlayout-core:1.1.0-alpha10
已发布。版本 1.1.0-alpha10 包含这些提交。
API 变更
MotionLayout
API 不再是实验性 API,这代表了MotionLayout
初始的稳定 API 集。(I288f4)- 移除了
MotionLayoutState
。(Id3ac1) - 您现在可以使用
DebugFlags
进行视觉调试:DebugFlags(showBounds = true)
。(Ic714b) - 将扩展变量
Dp.asDimension
更改为方法:Dp.asDimension()
。(I2d6ef) - 现在
MotionLayout
DSL 中支持交错(Staggered),使用TransitionScope.staggered
定义最大延迟,您也可以使用ConstrainScope.staggeredWeight
(在MotionSceneScope
内) 来获取自定义交错顺序。(I70275) - 网格辅助函数进行了两项更改:1. 将
paddingLeft
和paddingRight
分别更改为paddingStart
和paddingEnd
;2. 将gridSpans
和gridSkip
的格式更新为 Span 和 Skip 对象的数组,使其更具结构性。(Idd1eb)
版本 1.1.0-alpha09
2023 年 3 月 22 日
androidx.constraintlayout:constraintlayout-compose:1.1.0-alpha09
和 androidx.constraintlayout:constraintlayout-core:1.1.0-alpha09
已发布。版本 1.1.0-alpha09 包含这些提交。
API 变更
Modifier.intermediateLayout
现在不再需要显式的LookaheadScope
。intermediateLayout
中的测量块将IntermediateMeasureScope
作为接收者,这提供了方便的CoroutineScope
、LookaheadScope
和MeasureScope
。LookaheadLayout
已被LookaheadScope
替换,后者不再是 Layout。这使得LookaheadScope
中的子内容可以直接由父级的MeasurePolicy
控制。(Ibe2e5)Easing.Cubic()
现在可以接受过冲参数。(I2d826)
版本 1.1.0-alpha08
2023 年 3 月 8 日
androidx.constraintlayout:constraintlayout-compose:1.1.0-alpha08
和 androidx.constraintlayout:constraintlayout-core:1.1.0-alpha08
已发布。版本 1.1.0-alpha08 包含这些提交。
新功能
- 添加了 Lint 检查,以建议在典型模式可能导致不可预测行为的情况下使用
Dimension.percent(1f)
和LayoutReference.withChainParams()
。(I62eb0,I03060)
API 变更
- 为 Compose 中的 Grid Helper 启用
ReverseSpanDirection
和SpansOrderFirst
标志。ReverseSpanDirection
:反转跨度/跳过的宽度和高度规范。SpansOrderFirst
:跨度将遵循小部件的顺序。(I6ad50)
- 使用
Modifier.onStartEndBoundsChanged(...)
获取MotionLayout
中不受动画影响的 Composables 的本地边界。对于任何需要布局信息且可能触发动画(例如DragAndDrop
)的 UI 交互非常有用。(I6b5f9) - 在 Compose 中启用 Grid Helper 的跳过和跨度(I917b6)
Bug 修复
- 修复了转换属性未应用预期值的问题。(I961cd)
版本 1.1.0-alpha07
2023 年 2 月 8 日
androidx.constraintlayout:constraintlayout-compose:1.1.0-alpha07
和 androidx.constraintlayout:constraintlayout-core:1.1.0-alpha07
已发布。版本 1.1.0-alpha07 包含这些提交。
新功能
- 添加新 API,通过 DSL 在 Compose 中启用 Grid Helper(I1143b)
Bug 修复
- 修复了 Flow 的
Wrap.Chain
未正确布局到给定maxElement
参数的问题。(e1f2ed3) - 修复了通过
MotionLayout(motionScene: MotionScene, progress: Float, transitionName: String)
更改过渡时,start
ConstraintSet
未更新的问题。(17ffff1) - 修复了
ConstraintSet
通过ConstraintSet(extendConstraintSet: ConstraintSet, description: ConstraintSetScope.() -> Unit)
继承约束时未反映某些更改的问题。(740804b)
版本 1.1.0-alpha06
2023 年 1 月 25 日
androidx.constraintlayout:constraintlayout-compose:1.1.0-alpha06
和 androidx.constraintlayout:constraintlayout-core:1.1.0-alpha06
已发布。版本 1.1.0-alpha06 包含这些提交。
新功能
- 新增 API 以支持在 Compose 中使用 JSON 表示形式的网格辅助函数,允许可组合项放置在 2D 网格中。(I968ad)
API 变更
- 为
MotionLayout
添加了支持弧线向上和弧线向下模式的新 APIArc.Above
和Arc.Below
方向独立弧线模式。(I184a9) - 现在可以将基线锚点约束到顶部/底部锚点,反之亦然。(I54628)
- 将
MotionLayoutScope#motionProperties
(包括派生)重命名为MotionLayoutScope#customProperties
。这是为了与设置自定义属性保持一致。(Ib34c9) - 现在可以在
ConstraintSet
和MotionScene
中创建多个引用:val (box, text, button) = createRefsFor("box", "text","button")
。通过constrain(box, button, text)
对多个元素应用约束。在ConstrainScope
中,您现在可以直观地使用Dp.asDimension
设置固定尺寸:width = 10.dp.asDimension
。(I021ec,Ia0960) MotionScene()
和Transition()
方法现在是非可组合函数。这些函数中的对象(包括ConstraintSet
)现在应该能够相互正确比较。ConstraintLayout
中的animateChanges = true
现在可以仅与一个ConstraintSet
引用一起使用,只要其任何属性在重组时发生更改。(I7d22e)
Bug 修复
- 修复了
ConstraintLayout
在辅助程序更改时总是触发不必要的额外重组的问题。(Id83ad,b/222093277) - 修复了在使用 Intrinsics 与
ConstraintLayout
和MotionLayout
时的行为。(I487ae,b/220527863) - 修复了内容更改时无法重新测量的问题。(Ibfe8a,b/219091179)
版本 1.1.0-alpha05
2022 年 12 月 7 日
androidx.constraintlayout:constraintlayout-compose:1.1.0-alpha05
和 androidx.constraintlayout:constraintlayout-core:1.1.0-alpha05
已发布。版本 1.1.0-alpha05 包含这些提交。
新功能
- 支持 DSL 中的自定义
KeyAttributes
(b94e748) - 在
ConstrainScope
中显示偏差属性 (32625d0) - 支持链中的自定义参数 (72a2e9e)
- 为 Compose 中的
MotionLayout
添加宏基准测试 (36f43bc) - 有关 Compose 之前版本中的更改,请参阅wiki 页面
API 变更
- 翻转
addConstraintSet
和addTransition
参数 (152facc)
Bug 修复
- 修复了水平链(ed5f56e)
版本 1.1.0-alpha01
2022 年 5 月 20 日
androidx.constraintlayout:constraintlayout-compose:1.1.0-alpha01
已发布。
请注意,MotionLayout API 仍处于实验阶段,需要选择启用。
有关更多信息,请参阅 GitHub 上的 Compose 1.1.0-alpha01 中的新功能。
版本 2.2
版本 2.2.1
2025 年 2 月 26 日
androidx.constraintlayout:constraintlayout:2.2.1
已发布。版本 2.2.1 包含这些提交。
外部贡献
- 修复了
constraintlayout-core
库的二进制兼容性问题。感谢 Carlo Marinangeli!(I8952e, b/376718273)
版本 2.2.0
2024 年 10 月 30 日
androidx.constraintlayout:constraintlayout:2.2.0
已发布。版本 2.2.0 包含这些提交。
自 2.1.0 以来的重要变更
- 与底层 Constraintlayout-core 库的奇偶校验发布。
版本 2.2.0-rc01
2024 年 10 月 16 日
androidx.constraintlayout:constraintlayout:2.2.0-rc01
已发布。版本 2.2.0-rc01 包含这些提交。
版本 2.2.0-beta01
2024 年 9 月 4 日
androidx.constraintlayout:constraintlayout:2.2.0-beta01
已发布。版本 2.2.0-beta01 包含这些提交。
版本 2.2.0-alpha14
2024 年 8 月 7 日
androidx.constraintlayout:constraintlayout:2.2.0-alpha14
已发布。版本 2.2.0-alpha14 包含这些提交。
版本 2.2.0-alpha13
2023 年 10 月 4 日
androidx.constraintlayout:constraintlayout:2.2.0-alpha13
已发布,无任何更改。版本 2.2.0-alpha13 包含这些提交。
版本 2.2.0-alpha12
2023 年 8 月 9 日
androidx.constraintlayout:constraintlayout:2.2.0-alpha12
已发布。版本 2.2.0-alpha12 包含这些提交。
版本 2.2.0-alpha11
2023 年 7 月 26 日
androidx.constraintlayout:constraintlayout:2.2.0-alpha11
已发布。版本 2.2.0-alpha11 包含这些提交。
API 变更
- 添加了一个 setter 方法,允许开发者以编程方式设置
mInfiniteCarousel
的值(I0a8ca)
版本 2.2.0-alpha10
2023 年 5 月 24 日
androidx.constraintlayout:constraintlayout:2.2.0-alpha10
已发布。版本 2.2.0-alpha10 包含这些提交。
Bug 修复
- 修复了
MotionLayout
文档的损坏链接。(51cbe88)
版本 2.2.0-alpha09
2023 年 3 月 22 日
androidx.constraintlayout:constraintlayout:2.2.0-alpha09
已发布。版本 2.2.0-alpha09 包含这些提交。
版本 2.2.0-alpha08
2023 年 3 月 8 日
androidx.constraintlayout:constraintlayout:2.2.0-alpha08
已发布。版本 2.2.0-alpha08 包含这些提交。
版本 2.2.0-alpha07
2023 年 2 月 8 日
androidx.constraintlayout:constraintlayout:2.2.0-alpha07
已发布。版本 2.2.0-alpha07 包含这些提交。
Bug 修复
- 修复了
ConstraintLayout
页面内容丢失的问题。(I82e25)
版本 2.2.0-alpha05
2022 年 12 月 7 日
androidx.constraintlayout:constraintlayout:2.2.0-alpha05
已发布。版本 2.2.0-alpha05 包含这些提交。
- 有关之前版本更改的更多信息,请参阅Github wiki 页面
Bug 修复
- 修复了 View Carousel 中的内存泄漏(eb67b82)
版本 2.2.0-alpha01
2022 年 5 月 20 日
androidx.constraintlayout:constraintlayout:2.2.0-alpha01
已发布。
包括新 Grid
辅助工具的预览。
有关更多信息,请参阅 GitHub 上的 2.2.0-alpha01 中的新功能。
ConstraintLayout-compose 1.0
ConstraintLayout-compose 1.0 在 Jetpack Compose 中提供了 ConstraintLayout 功能。
版本 1.0.1
2022 年 5 月 20 日
androidx.constraintlayout:constraintlayout-compose:1.0.1
已发布。
请注意,MotionLayout API 仍处于实验阶段,需要选择启用。
有关更多信息,请参阅 GitHub 上的 Compose 1.0.1 中的新功能。
版本 1.0.0
2022 年 1 月 13 日
androidx.constraintlayout:constraintlayout-compose:1.0.0
已发布。
请注意,MotionLayout API 现在是实验性 API,需要选择启用。
有关更多信息,请参阅 GitHub 文章 1.0 (Compose) 中的新功能。
版本 1.0.0-rc02
2021 年 11 月 16 日
androidx.constraintlayout:constraintlayout-compose:1.0.0-rc02
已发布。
有关更多信息,请参阅 GitHub 文章 1.0 (Compose) 中的新功能。
版本 1.0.0-rc01
2021 年 9 月 27 日
androidx.constraintlayout:constraintlayout-compose:1.0.0-rc01
已发布。
此版本是第二个 Beta 版。它被认为是功能完备的,为 Compose 提供了 ConstraintLayout
和 MotionLayout
。
有关更多信息,请参阅 GitHub 文章 1.0 (Compose) 中的新功能。
版本 1.0.0-beta02
2021 年 7 月 30 日
androidx.constraintlayout:constraintlayout-compose:1.0.0-beta02
已发布。
此版本是第二个 Beta 版。它被认为是功能完备的,为 Compose 提供了 ConstraintLayout
和 MotionLayout
。
有关更多信息,请参阅 GitHub 文章 1.0 (Compose) 中的新功能。
版本 1.0.0-beta01
2021 年 7 月 22 日
androidx.constraintlayout:constraintlayout-compose:1.0.0-beta01
已发布。
此版本是第一个 Beta 版。它被认为是功能完备的,为 Compose 提供了 ConstraintLayout
和 MotionLayout
。
有关更多信息,请参阅 GitHub 文章 1.0 (Compose) 中的新功能。
版本 1.0.0-alpha07
2021 年 5 月 18 日
androidx.constraintlayout:constraintlayout-compose:1.0.0-alpha07
已发布。
- 更新以兼容 Compose 版本
1.0.0-beta07
。
版本 1.0.0-alpha06
2021 年 5 月 4 日
androidx.constraintlayout:constraintlayout-compose:1.0.0-alpha06
已发布。
- Compose 优化:Constraintlayout 内联可组合项 (#193)
- 最小化 Compose 中的重新测量 (#210)
版本 1.0.0-alpha05
2021 年 3 月 15 日
androidx.constraintlayout:constraintlayout-compose:1.0.0-alpha05
已发布。
- 包含优化引擎的修复 (b/182657720)
- 向 ConstraintLayout 可组合项添加一个 optimizationLevel 参数
版本 1.0.0-alpha04
2021 年 3 月 11 日
androidx.constraintlayout:constraintlayout-compose:1.0.0-alpha04
已发布。
更新以使用最新的 Constraintlayout-core 引擎
版本 1.0.0-alpha03
2021 年 2 月 24 日
androidx.constraintlayout:constraintlayout-compose:1.0.0-alpha03
已发布。
Jetpack Compose beta01 版本更新
版本 1.0.0-alpha02
2021 年 2 月 10 日
androidx.constraintlayout:constraintlayout-compose:1.0.0-alpha02
已发布。
Jetpack Compose alpha12 版本更新
版本 1.0.0-alpha01
2021 年 2 月 2 日
androidx.constraintlayout:constraintlayout-compose:1.0.0-alpha01
已发布。
库的第一个版本,提供了内联和外部 DSL 以表达约束。
版本 2.1
ConstraintLayout 2.1.0 在 MotionLayout 中提供了更丰富的功能和新的辅助工具(Carousel 等)。
版本 2.1.4
2022 年 5 月 20 日
androidx.constraintlayout:constraintlayout:2.1.4
已发布。
有关更多信息,请参阅 GitHub 上的 2.1.4 中的新功能。
版本 2.1.3
2022 年 1 月 13 日
androidx.constraintlayout:constraintlayout:2.1.3
已发布。
有关更多信息,请参阅 GitHub 文章 2.1 中的新功能。
版本 2.1.2
2021 年 11 月 16 日
androidx.constraintlayout:constraintlayout:2.1.2
已发布。
有关更多信息,请参阅 GitHub 文章 2.1 中的新功能。
版本 2.1.1
2021 年 9 月 27 日
androidx.constraintlayout:constraintlayout:2.1.1
已发布。
这是 2.1.1 的最终版本。
有关更多信息,请参阅 GitHub 文章 2.1 中的新功能。
版本 2.1.0
2021 年 7 月 30 日
androidx.constraintlayout:constraintlayout:2.1.0
已发布。
这是 2.1.0 的最终版本。
有关更多信息,请参阅 GitHub 文章 2.1 中的新功能。
版本 2.1.0-rc01
2021 年 7 月 22 日
androidx.constraintlayout:constraintlayout:2.1.0-rc01
已发布。
这是 2.1.0 的候选发布版本,提供了上次 Beta 版的少量改进和修复。有关更多信息,请参阅 GitHub 文章 2.1 中的新功能。
版本 2.1.0-beta02
2021 年 5 月 4 日
androidx.constraintlayout:constraintlayout:2.1.0-beta02
已发布。
MotionLayout 中的一些新功能
- OnSwipe 增强,包括弹性(刚度、阻尼、质量等)& 永不完成
- jumpToState 函数
- ViewTransition downUp 模式,触摸按下时播放到 100,抬起时反转到 0
各种修复,尤其是
- 修复了 MotionLayout 中的垂直滚动问题 (#173)
- 改进了嵌套 MotionLayout 的性能 (#189)
- MotionLayout 中 NestedScrollView 的快速过渡 (#189)
- MotionLayout 中 ConstraintSet 消失 (#189)
- 支持 MotionLayout 中的 downUp ViewTransitions (#190)
- 修复了 ImageFilter 在重用可绘制对象时的问题 (#192)
- 在 MotionLayout 中添加了弹性支持 (#199)
- CircularFlow 的性能改进 (#200)
- 修复了派生约束/约束覆盖问题 (#212)
版本 2.1.0-beta01
2021 年 3 月 11 日
androidx.constraintlayout:constraintlayout:2.1.0-beta01
已发布。
ConstraintLayout
由于兼容性问题,android:layout_width 和 android:layout_height 再次成为非可选属性。
MotionLayout
- 以编程方式支持在 Transitions 上插入和删除 onSwipe 和 onClick
- 支持通过屏幕旋转进行过渡(实验性)
- 支持过渡的 duration 参数
- 更好地支持布尔值或引用的 customAttributes
辅助工具
- 添加了一种动画或直接跳转到 Carousel 中给定项的方法
- 新的 CircularFlow 辅助工具
版本 2.1.0-alpha2
2020 年 12 月 17 日
androidx.constraintlayout:constraintlayout:2.1.0-alpha2
已发布。
此第二个 Alpha 版本添加了几项新功能
ConstraintLayout
- android:layout_width 和 android:layout_height 现在是可选的,默认行为为 wrap_content
- 用于表达尺寸约束的新属性 layout_constraintWidth 和 layout_constraintHeight
- 支持负边距约束
- 支持基线到顶部和基线到底部约束
- 支持基线边距约束
- SharedValues 允许将外部值注入 ConstraintLayout
MotionLayout
- 支持过冲插值器(anticipate、overshoot)
- 增强的 MotionHelper 支持
- 向 MotionLayout 添加 ConstraintSet 的动画更新 MotionLayout updateStateAnimate(id,cset,duration);
- 基于共享值的 ViewTransition
- scheduleTransitonTo 允许您排队等待过渡在当前过渡完成后运行。
辅助工具
- Carousel 现在支持无限(环绕)模式
- ReactiveGuide:当 SharedValue 更改时自动定位的指南
- MotionEffect:将关键帧注入沿给定方向移动的引用视图
- MotionLabel - 用于动画单行文本的视图
有关此版本的更多信息,请参阅此处。
版本 2.1.0-alpha1
2020 年 11 月 19 日
androidx.constraintlayout:constraintlayout:2.1.0-alpha1
已发布。
2.1 版本的第一个 Alpha 版。引入了以下支持:
- Carousel 运动辅助工具,用于构建自定义轮播视图
- MotionLayout 场景支持包含和约束覆盖
- MotionLayout 添加了更丰富的旋转支持(输入和输出)
- MotionLayout 添加了 ViewTransitions,允许单个视图过渡以更改约束集
有关此版本的更多信息,请参阅此处。
版本 2.0
ConstraintLayout 2.0 增加了布局的新功能(虚拟布局等)以及一个简化视图动画的新类 MotionLayout。
版本 2.0.4
2020 年 10 月 29 日
androidx.constraintlayout:constraintlayout:2.0.4
已发布。
Bug 修复
此版本修复了运行时删除子视图时可能发生的潜在 NPE。建议更新到此版本。
请参阅已关闭问题的列表此处。
版本 2.0.3
2020 年 10 月 27 日
androidx.constraintlayout:constraintlayout:2.0.3
已发布。
Bug 修复
此版本修复了一些问题。建议更新到此版本。
- Windows 内边距处理
- 在某些情况下处理维度比率
- 某些 RTL 布局崩溃
请参阅已关闭问题的列表此处。
版本 2.0.2
2020 年 10 月 6 日
androidx.constraintlayout:constraintlayout:2.0.2
已发布。
Bug 修复
此版本提高了性能并修复了一些问题。建议更新到此版本。
- ConstraintLayout 中对视图 GONE 可见性的处理在某些情况下不正确
- ConstraintLayout 中对打包链的处理在某些情况下不正确
- 修复了 API 15 上 Flow 虚拟布局助手膨胀异常
- MotionLayout 中 limitsBoundsTo 损坏
- MotionLayout 在某些情况下(链式过渡)跳转到末尾的功能损坏
请参阅已关闭问题的列表此处。
版本 2.0.1
2020 年 8 月 25 日
androidx.constraintlayout:constraintlayout:2.0.1
已发布。
这是一个次要更新,支持在 Android Studio 中使用 MotionEditor。
版本 2.0.0
2020 年 8 月 21 日
androidx.constraintlayout:constraintlayout:2.0.0
已发布。
Bug 修复
请参阅已关闭问题的列表此处。
主要修复包括
- MotionLayout 过渡延迟 & TransitionListener 修复
- ConstraintLayout flow & barrier 修复
版本 2.0.0-rc1
2020 年 7 月 29 日
androidx.constraintlayout:constraintlayout:2.0.0-rc1
已发布。
Bug 修复
请参阅已关闭问题的列表此处。
主要修复包括
- Flow 修复
- RecyclerView 修复(建议更新到 recyclerview 1.2.0 alpha 5 或更高版本)
- MotionLayout TransitionListener 修复
- MotionLayout 内存泄漏修复
版本 2.0.0-beta8
2020 年 7 月 7 日
androidx.constraintlayout:constraintlayout:2.0.0-beta8
已发布。
Bug 修复
请参阅已关闭问题的列表此处。
主要修复包括
- 占位符行为
- 图层可见性
- Flow、Barrier 修复
- TransitionListener 修复
版本 2.0.0-beta7
2020 年 6 月 12 日
androidx.constraintlayout:constraintlayout:2.0.0-beta7
已发布。
Bug 修复
请参阅已关闭问题的列表此处。
主要修复包括
- MotionLayout 中的嵌套滚动视图问题
- MotionLayout 的过渡监听器问题
- MotionLayout 中的内存泄漏
- RecyclerView 问题
- 组可见性
- 内边距问题
版本 2.0.0-beta6
2020 年 5 月 13 日
androidx.constraintlayout:constraintlayout:2.0.0-beta6
已发布。
Bug 修复
请参阅已关闭问题的列表此处。值得注意的修复包括组可见性处理和 MotionLayout 中派生约束的问题。
版本 2.0.0-beta5
2020 年 5 月 7 日
androidx.constraintlayout:constraintlayout:2.0.0-beta5
已发布。
Bug 修复
请参阅已关闭问题的列表此处
版本 2.0.0-beta4
2019 年 12 月 16 日
androidx.constraintlayout:constraintlayout:2.0.0-beta4
已发布。
新功能
MotionLayout
Transition 中的新属性
- layoutDuringTransition:允许您配置 MotionLayout 在过渡期间如何响应子级的 requestLayouts 调用。可能的值为 {ignoreRequest, honorRequest}
- pathMotionArc:元素移动的路径将使用弧线。可能的值为 {startVertical | startHorizontal | flip | none }
现在可以定义默认过渡,只需省略开始和结束 ConstraintSets。如果没有其他现有过渡能够匹配当前开始/结束状态,则将使用该默认过渡。
Bug 修复
请参阅已关闭问题的列表此处