Coordinatorlayout

  
定位顶级应用微件,例如 AppBarLayout 和 FloatingActionButton。
最新更新 稳定版 发布候选版本 Beta 版 Alpha 版
2025 年 2 月 26 日 1.3.0 - - -

声明依赖项

要添加对 CoordinatorLayout 的依赖项,您必须将 Google Maven 代码库添加到您的项目。如需了解详情,请参阅 Google 的 Maven 代码库

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

Groovy

dependencies {
    implementation "androidx.coordinatorlayout:coordinatorlayout:1.3.0"
}

Kotlin

dependencies {
    implementation("androidx.coordinatorlayout:coordinatorlayout:1.3.0")
}

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

反馈

您的反馈有助于改进 Jetpack。如果您发现新问题或有改进此库的建议,请告知我们。在创建新问题之前,请先查看此库中的现有问题。您可以通过点击星形按钮为您已有的问题添加投票。

创建新问题

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

版本 1.3

版本 1.3.0

2025 年 2 月 26 日

androidx.coordinatorlayout:coordinatorlayout:1.3.0 已发布。版本 1.3.0 包含这些提交

自 1.2.0 以来的重要变更

新功能

  • 增加了对 Page Up、Page Down、Home 和 End 键事件的支持。(14719d3
  • 添加了 RecyclerView 在带可折叠应用栏的 CoordinatorLayout 中以及 PreferenceScreen 在带可折叠应用栏的 CoordinatorLayout 中的演示。(fca56e0I4c679

问题修复

  • 修复了 CoordinatorLayoutNestedScrollView 的向上、向下、空格键和按键变体键盘操作。(I216f4
  • 修复了在 CoordinatorLayout 中使用 recyclerview 时,键盘向下操作可正确折叠应用栏的问题。(I7eac4

版本 1.3.0-rc01

2025 年 2 月 12 日

androidx.coordinatorlayout:coordinatorlayout:1.3.0-rc01 已发布。版本 1.3.0-rc01 包含这些提交

版本 1.3.0-beta01

2025 年 1 月 29 日

androidx.coordinatorlayout:coordinatorlayout:1.3.0-beta01 已发布。版本 1.3.0-beta01 包含这些提交

版本 1.3.0-alpha03

2025 年 1 月 15 日

androidx.coordinatorlayout:coordinatorlayout:1.3.0-alpha03 已发布。版本 1.3.0-alpha03 包含这些提交

问题修复

  • 此库现在使用 JSpecify nullness 注解,它们是类型使用的。Kotlin 开发者应使用以下编译器参数来强制执行正确用法:-Xjspecify-annotations=strict(从 Kotlin 编译器 2.1.0 版开始,这是默认设置)。(I9ab25b/326456246
  • CoordinatorLayout 中使用 recyclerview 时,应用栏现在可以随键盘向下操作而正确折叠。

版本 1.3.0-alpha02

2023 年 10 月 4 日

androidx.coordinatorlayout:coordinatorlayout:1.3.0-alpha02 已发布。版本 1.3.0-alpha02 包含这些提交。

  • 版本更新发布,与 1.3.0-alpha01 相比无变化。

版本 1.3.0-alpha01

2023 年 9 月 20 日

androidx.coordinatorlayout:coordinatorlayout:1.3.0-alpha01 已发布。版本 1.3.0-alpha01 包含这些提交。

新功能

  • 增加了对 Page Up、Page Down、Home 和 End 键事件的支持。(14719d3

API 变更

  • CoordinatorLayout.java 中添加了可为空性注解。(Ieb647b/236474453

问题修复

  • 修复了 NestedScrollViewCoordinatorLayout 的向上、向下、空格键和按键变体键盘操作。(bdd72e6

版本 1.2

版本 1.2.0

2022 年 1 月 12 日

androidx.coordinatorlayout:coordinatorlayout:1.2.0 已发布。版本 1.2.0 包含这些提交。

自 1.1.0 以来的重要变更

  • 仅在 CoordinatorLayout 规则中保留运行时可见注解 (9ec7cb)

版本 1.2.0-rc01

2021 年 12 月 15 日

androidx.coordinatorlayout:coordinatorlayout:1.2.0-rc01 已发布。版本 1.2.0-rc01 包含这些提交。

版本 1.2.0-beta01

2021 年 11 月 17 日

androidx.coordinatorlayout:coordinatorlayout:1.2.0-beta01 已发布。版本 1.2.0-beta01 包含这些提交。

API 变更

  • API 已针对 Beta 版最终确定。

版本 1.2.0-alpha01

2021 年 11 月 3 日

androidx.coordinatorlayout:coordinatorlayout:1.2.0-alpha01 已发布。版本 1.2.0-alpha01 包含这些提交。

问题修复

  • 仅在 CoordinatorLayout 规则中保留运行时可见注解 (9ec7cb)

版本 1.1.0

版本 1.1.0

2019 年 12 月 4 日

androidx.coordinatorlayout:coordinatorlayout:1.1.0 已发布。版本 1.1.0 包含这些提交

自 1.0.0 以来的重要变更

  • aosp/737190CoordinatorLayout 现在实现了 NestedScrollingParent3,而 CoordinatorLayout.Behavior 实现了 onNestedScroll 的新重载,以便 Behaviors 能够向嵌套滚动子项报告它们消耗的滚动距离(在 dispatchNestedScroll()/onNestedScroll() 传递期间)。以前的 onNestedScroll(CoordinatorLayout, V, View, int, int, int, int, int) 已被弃用,取而代之的是新的 onNestedScroll(CoordinatorLayout, V, View, int, int, int, int, int, int[])Behavior 实现应相应更新。如果开发者代码当前重写了 CoordinatorLayout#onNestedScroll(View, int, int, int, int, int),则很可能不再调用它,而应重写 CoordinatorLayout#onNestedScroll(View, int, int, int, int, int, int[])
  • 将 CoordinatorLayout 公开给无障碍服务 (aosp/1056175)
  • CoordinatorLayout.DefaultBehavior 注解已弃用。请改用 CoordinatorLayout.AttachedBehavior 接口。

版本 1.1.0-rc01

2019 年 10 月 23 日

androidx.coordinatorlayout:coordinatorlayout:1.1.0-rc01 已发布。版本 1.1.0-rc01 包含这些提交

新功能

  • 将 CoordinatorLayout 公开给无障碍服务 (aosp/1056175)

版本 1.1.0-beta01

2019 年 6 月 5 日

androidx.coordinatorlayout:coordinatorlayout:1.1.0-beta01 已发布。此版本中包含的提交可在此处找到。

问题修复

版本 1.1.0-alpha01

2018 年 12 月 3 日

API 变更

  • aosp/737190CoordinatorLayout 现在实现了 NestedScrollingParent3,而 CoordinatorLayout.Behavior 实现了 onNestedScroll 的新重载,以便 Behaviors 能够向嵌套滚动子项报告它们消耗的滚动距离(在 dispatchNestedScroll()/onNestedScroll() 传递期间)。以前的 onNestedScroll(CoordinatorLayout, V, View, int, int, int, int, int) 已被弃用,取而代之的是新的 onNestedScroll(CoordinatorLayout, V, View, int, int, int, int, int, int[])Behavior 实现应相应更新。

    如果开发者代码当前重写了 CoordinatorLayout#onNestedScroll(View, int, int, int, int, int),则很可能不再调用它,而应重写 CoordinatorLayout#onNestedScroll(View, int, int, int, int, int, int[])