Constraintlayout

使用相对定位灵活地确定 widget 的位置和大小。

下表列出了 androidx.constraintlayout 组中的所有工件。

制品 稳定版 候选版 Beta 版 Alpha 版
constraintlayout 2.1.4 - - 2.2.0-alpha13
constraintlayout-compose 1.0.1 - - 1.1.0-alpha13
constraintlayout-core 1.0.4 - - 1.1.0-alpha13

声明依赖项

如需添加 ConstraintLayout 的依赖项,您必须将 Google Maven 制品库添加到项目中。如需了解详情,请参阅 Google 的 Maven 制品库

在应用或模块的 build.gradle 文件中添加所需工件的依赖项:

Groovy

dependencies {
    implementation "androidx.constraintlayout:constraintlayout:2.2.0-alpha13"
    // To use constraintlayout in compose
    implementation "androidx.constraintlayout:constraintlayout-compose:1.1.0-alpha13"
}

Kotlin

dependencies {
    implementation("androidx.constraintlayout:constraintlayout:2.2.0-alpha13")
    // To use constraintlayout in compose
    implementation("androidx.constraintlayout:constraintlayout-compose:1.1.0-alpha13")
}

如需详细了解依赖项,请参阅添加 build 依赖项

反馈

您的反馈将帮助我们改进 Jetpack。如果您发现了新问题,或对此库有任何改进建议,请告诉我们。创建新问题前,请先查看此库中的现有问题。您可以点击星标按钮,为现有问题投票。

创建新问题

如需了解详情,请参阅问题跟踪器文档

ConstraintLayout-compose 和 ConstraintLayout-Core 1.1

版本 1.1.0-alpha13

2023 年 10 月 4 日

发布了 androidx.constraintlayout:constraintlayout-compose:1.1.0-alpha13androidx.constraintlayout:constraintlayout-compose-android:1.1.0-alpha13androidx.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-alpha12androidx.constraintlayout:constraintlayout-compose-android:1.1.0-alpha12androidx.constraintlayout:constraintlayout-core:1.1.0-alpha12版本 1.1.0-alpha12 中包含这些提交内容

API 变更

  • 添加了 LayoutScopeMarker 以转换 DSL。(If54ce)

版本 1.1.0-alpha11

2023 年 7 月 26 日

发布了 androidx.constraintlayout:constraintlayout-compose:1.1.0-alpha11androidx.constraintlayout:constraintlayout-compose-android:1.1.0-alpha11androidx.constraintlayout:constraintlayout-core:1.1.0-alpha11版本 1.1.0-alpha11 中包含这些提交内容

新功能

  • 您现在可以提供 InvalidationStrategy 来优化 MotionLayout 中的失效操作。这通常是导致效果下降的原因。(Iada0c)
  • 现在,将 ConstraintLayout 与内嵌修饰符 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 可组合项和 Constraintset 的 KDoc。(3bfe63)

版本 1.1.0-alpha10

2023 年 5 月 24 日

发布了 androidx.constraintlayout:constraintlayout-compose:1.1.0-alpha10androidx.constraintlayout:constraintlayout-compose-android:1.1.0-alpha10androidx.constraintlayout:constraintlayout-core:1.1.0-alpha10版本 1.1.0-alpha10 中包含这些提交内容

API 变更

  • MotionLayout API 不再处于实验阶段,这表示 MotionLayout 的初始稳定 API 集。(I288f4
  • 移除了 MotionLayoutState。(Id3ac1)
  • 您现在可以使用 DebugFlags 进行视觉调试:DebugFlags(showBounds = true)。(Ic714b
  • 已将扩展变量 Dp.asDimension 更改为方法:Dp.asDimension()。(I2d6ef
  • 现在,MotionLayout DSL 支持交错,请使用 TransitionScope.staggered 定义最大延迟,您还可以使用 ConstrainScope.staggeredWeight(在 MotionSceneScope 内)获取自定义的交错顺序。(I70275
  • 对网格帮助程序进行了两项更改:1. 将 paddingLeftpaddingRight 分别更新为 paddingStartpaddingEnd;以及 2. 将 gridSpansgridSkip 的格式更新为 Span 和 Skip 对象的数组,使其结构更清晰。(Idd1eb

版本 1.1.0-alpha09

2023 年 3 月 22 日

发布了 androidx.constraintlayout:constraintlayout-compose:1.1.0-alpha09androidx.constraintlayout:constraintlayout-core:1.1.0-alpha09版本 1.1.0-alpha09 中包含这些提交内容

API 变更

  • Modifier.intermediateLayout 现在不需要显式 LookaheadScopeintermediateLayout 中的测量块将 IntermediateMeasureScope 作为接收器,它可提供便捷的 CoroutineScopeLookaheadScopeMeasureScope
  • LookaheadLayout 已替换为 LookaheadScope,后者不再是布局。这样,LookaheadScope 中的子项内容就可以由父级的 MeasurePolicy 直接控制。(Ibe2e5
  • Easing.Cubic() 现在可以接受过冲参数。(I2d826

版本 1.1.0-alpha08

2023 年 3 月 8 日

发布了 androidx.constraintlayout:constraintlayout-compose:1.1.0-alpha08androidx.constraintlayout:constraintlayout-core:1.1.0-alpha08版本 1.1.0-alpha08 中包含这些提交内容

新功能

  • 添加了 Lint 检查,以便在典型模式可能导致不可预测行为的情况下建议使用 Dimension.percent(1f)LayoutReference.withChainParams()。(I62eb0I03060

API 变更

  • 在 Compose 中为 Grid Helper 启用 ReverseSpanDirectionSpansOrderFirst 标志。
    1. ReverseSpanDirection:反转跨度/跳过的宽度和高度规范。
    2. SpansOrderFirst:span 会遵循 widget 的顺序。(I6ad50
  • 使用 Modifier.onStartEndBoundsChanged(...) 可获取 MotionLayout 中不受动画影响的可组合项的本地边界。对于需要布局信息也可以触发动画(如 DragAndDrop)的任何界面交互,此方法很有用。(I6b5f9
  • 在 Compose 中启用 Grid Helper 的跳过和跨度 (I917b6)

bug 修复

  • 修复了转换属性无法应用预期值的问题。(I961cd)

版本 1.1.0-alpha07

2023 年 2 月 8 日

发布了 androidx.constraintlayout:constraintlayout-compose:1.1.0-alpha07androidx.constraintlayout:constraintlayout-core:1.1.0-alpha07版本 1.1.0-alpha07 中包含这些提交内容

新功能

  • 添加了新的 API,以使用 DSL 在 Compose 中启用 Grid Helper (I1143b)

bug 修复

  • 修复了流的 maxElement 针对给定 Wrap.Chain 参数无法正确布置的问题。(e1f2ed3)
  • 修复了在通过 MotionLayout(motionScene: MotionScene, progress: Float, transitionName: String) 更改 Transition 时 start ConstraintSet 无法更新的问题。(17ffff1)
  • 修复了在通过 ConstraintSet(extendConstraintSet: ConstraintSet, description: ConstraintSetScope.() -> Unit) 继承约束时 ConstraintSet 无法反映某些更改的问题。(740804b)

版本 1.1.0-alpha06

2023 年 1 月 25 日

发布了 androidx.constraintlayout:constraintlayout-compose:1.1.0-alpha06androidx.constraintlayout:constraintlayout-core:1.1.0-alpha06版本 1.1.0-alpha06 中包含这些提交内容

新功能

  • 添加了新的 API,以使用 JSON 表示法在 Compose 中启用 Grid Helper,让可组合项能够放置在 2D 网格中。(I968ad)

API 变更

  • MotionLayout 添加了对向上弧线和向下弧线模式的支持,以及对 Arc.AboveArc.Below 方向的独立弧线模式的支持 (I184a9)
  • 现在可将基线锚点限制为顶部/底部锚点,反之亦然。(I54628)
  • MotionLayoutScope#motionProperties(包括衍生体)已重命名为 MotionLayoutScope#customProperties。设置自定义属性时,这可确保一致性。(Ib34c9)
  • 现在可以在 ConstraintSetMotionScene 中创建多个引用:val (box, text, button) = createRefsFor("box", "text","button")。使用 constrain(box, button, text) 对多个元素应用限制条件。在 ConstrainScope 中,您现在可以使用 Dp.asDimension 直观地设置固定尺寸:width = 10.dp.asDimension。(I021ecIa0960
  • MotionScene()Transition() 方法现在是非可组合函数。这些函数(包括 ConstraintSet)中的对象现在应能正确地相互比较。现在,只要重组时其属性发生了更改,ConstraintLayout 中的 animateChanges = true 便只能与一个 ConstraintSet 引用一起使用。(I7d22e)

bug 修复

  • 修复了帮助程序发生更改时 ConstraintLayout 一律会触发不必要的额外重组的问题。(Id83adb/222093277
  • 修复了固有特性与 ConstraintLayoutMotionLayout 一起使用时的行为。(I487aeb/220527863
  • 修复了内容发生更改时无法重新测量的问题。(Ibfe8ab/219091179

版本 1.1.0-alpha05

2022 年 12 月 7 日

发布了 androidx.constraintlayout:constraintlayout-compose:1.1.0-alpha05androidx.constraintlayout:constraintlayout-core:1.1.0-alpha05版本 1.1.0-alpha05 中包含这些提交内容

新功能

  • 支持 DSL 中的自定义 KeyAttributes (b94e748)
  • ConstrainScope 中的 Surface 偏差属性 (32625d0)
  • 支持链中的自定义参数 (72a2e9e)
  • 在 Compose 中为 MotionLayout 添加了 Macrobenchmark 测试 (36f43bc)
  • 如需详细了解 Compose 的上一版本中的变化,请参阅 Wiki 页面

API 变更

  • 翻转 addConstraintSetaddTransition 参数 (152facc)

bug 修复

版本 1.1.0-alpha01

2022 年 5 月 20 日

发布了 androidx.constraintlayout:constraintlayout-compose:1.1.0-alpha01

请注意,MotionLayout API 属于实验性 API,需要选择启用才能使用。

如需了解详情,请参阅 GitHub 上的 Compose 1.1.0-alpha01 中的新功能

版本 2.2

版本 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 中包含这些提交内容。

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 属于实验性 API,需要选择启用才能使用。

如需了解详情,请参阅 GitHub 上的 Compose 1.0.1 中的新功能

版本 1.0.0

2022 年 1 月 13 日

发布了 androidx.constraintlayout:constraintlayout-compose:1.0.0

请注意,MotionLayout 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 提供 ConstraintLayoutMotionLayout

如需了解详情,请参阅 GitHub 文章 1.0 (Compose) 的新功能

版本 1.0.0-beta02

2021 年 7 月 30 日

发布了 androidx.constraintlayout:constraintlayout-compose:1.0.0-beta02

此版本是第二个 Beta 版。我们将此版本视为功能完整的版本,向 Compose 提供 ConstraintLayoutMotionLayout

如需了解详情,请参阅 GitHub 文章 1.0 (Compose) 的新功能

版本 1.0.0-beta01

2021 年 7 月 22 日

发布了 androidx.constraintlayout:constraintlayout-compose:1.0.0-beta01

此版本是第一个 Beta 版。我们将此版本视为功能完整的版本,向 Compose 提供 ConstraintLayoutMotionLayout

如需了解详情,请参阅 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

  • 对在 Transition 中插入和移除 onSwipe 和 onClick 提供了程序化支持
  • 对通过屏幕旋转实现过渡效果提供了实验性支持
  • 支持使用时长参数设置过渡效果
  • 更好地支持类型为布尔值或 Reference 的 customAttribute

帮助程序

  • 添加了一种为轮播界面添加动画效果或直接跳转到某个指定项目的方式
  • 全新的 CircularFlow 帮助程序

如需查看有关此版本的更多信息,请参阅这篇文章已关闭的 bug

版本 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 updateStateAnimate(id,cset,duration); 添加了 ConstraintSet 的含动画效果的更新
  • 基于共享值的 ViewTransition
  • 借助 scheduleTransitonTo,您可以将过渡加入队列,使其在当前过渡完毕后运行。

帮助程序

  • 轮播界面现支持无限(环绕)模式
  • ReactiveGuide:一项说明如何在 SharedValue 发生变化时自动定位到自身的准则
  • MotionEffect:将 Keyframe 注入沿给定方向移动的引用 View 中
  • MotionLabel - 用于对单行文本添加动画效果的 View

如需查看有关此版本的更多信息,请点击此处

版本 2.1.0-alpha1

2020 年 11 月 19 日

发布了 androidx.constraintlayout:constraintlayout:2.1.0-alpha1

2.1 版的第一个 Alpha 版本。引入了对以下项目的支持:

  • 轮播界面动作帮助程序,用于构建自定义轮播视图
  • MotionLayout 场景支持 include 和约束覆盖
  • 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 修复

此版本修复了几个问题。建议更新到此版本。

  • 窗口边衬区处理
  • 某些情况下的尺寸比处理
  • 与一些 RTL 布局相关的崩溃问题

如需查看已解决的问题的列表,请点击此处

版本 2.0.2

2020 年 10 月 6 日

发布了 androidx.constraintlayout:constraintlayout:2.0.2

bug 修复

此版本改进了性能并修复了几个问题。建议更新到此版本。

  • 在某些情况下,对 ConstraintLayout 中视图 GONE 可见性的处理不正确
  • 在某些情况下,对 ConstraintLayout 中打包的链的处理不正确
  • 修复了流虚拟布局帮助程序在 API 15 上的膨胀异常
  • limitsBoundsTo 在 MotionLayout 中被打断
  • 在某些情况下,跳转到结尾在 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 流与屏障修复

版本 2.0.0-rc1

2020 年 7 月 29 日

发布了 androidx.constraintlayout:constraintlayout:2.0.0-rc1

bug 修复

如需查看已解决的问题的列表,请点击此处

重要修复包括:

  • 流修复
  • 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 修复

如需查看已解决的问题的列表,请点击此处

重要修复包括:

  • 占位符行为
  • 层可见性
  • 流与屏障修复
  • 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 在转换期间应如何响应子级的 requestLayout 调用。可能的值有 {ignoreRequest, honorRequest}
  • pathMotionArc:元素移动将采用圆弧路径。可能的值有 {startVertical | startHorizontal | flip | none }

现在,只需省略起始和结束 ConstraintSet 即可定义默认转换。如果找不到其他与当前起始/结束状态匹配的现有转换,则会使用该默认转换。

bug 修复

如需查看已解决的问题的列表,请点击此处