远程 Compose

  
远程 Compose 是一个用于为远程 surface 创建界面的框架
最近更新时间 稳定版 候选版 Beta 版 Alpha 版
2026 年 5 月 19 日 - - - 1.0.0-alpha11

声明依赖项

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

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

Groovy

dependencies {
    implementation "androidx.compose.remote:remote-core:1.0.0-alpha11"

    // Use to create Remote Compose documents
    implementation "androidx.compose.remote:remote-creation:1.0.0-alpha11"
    implementation "androidx.compose.remote:remote-creation-core:1.0.0-alpha11"
    implementation "androidx.compose.remote:remote-creation-android:1.0.0-alpha11"
    implementation "androidx.compose.remote:remote-creation-jvm:1.0.0-alpha11"
    implementation "androidx.compose.remote:remote-creation-compose:1.0.0-alpha11"

    // Use to render a Remote Compose document
    implementation "androidx.compose.remote:remote-player-core:1.0.0-alpha11"
    implementation "androidx.compose.remote:remote-player-view:1.0.0-alpha11"

    implementation "androidx.compose.remote:remote-tooling-preview:1.0.0-alpha11"
}

Kotlin

dependencies {
    implementation("androidx.compose.remote:remote-core:1.0.0-alpha11")

    // Use to create Remote Compose documents
    implementation("androidx.compose.remote:remote-creation:1.0.0-alpha11")
    implementation("androidx.compose.remote:remote-creation-core:1.0.0-alpha11")
    implementation("androidx.compose.remote:remote-creation-android:1.0.0-alpha11")
    implementation("androidx.compose.remote:remote-creation-jvm:1.0.0-alpha11")
    implementation("androidx.compose.remote:remote-creation-compose:1.0.0-alpha11")

    // Use to render a Remote Compose document
    implementation("androidx.compose.remote:remote-player-core:1.0.0-alpha11")
    implementation("androidx.compose.remote:remote-player-view:1.0.0-alpha11")

    implementation("androidx.compose.remote:remote-tooling-preview:1.0.0-alpha11")
}

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

反馈

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

创建新问题

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

版本 1.0

版本 1.0.0-alpha11

2026 年 5 月 19 日

发布了 androidx.compose.remote:remote-*:1.0.0-alpha11。版本 1.0.0-alpha11 中包含 这些提交内容

API 变更

  • 公开了 RemoteInt 静态工厂。(Ic0096b/484137042
  • 公开了 RemoteState 静态工厂(I544f0b/484137042
  • RemoteLong 现在支持算术运算符的有限子集(加法、减法、乘法和截断转换为 RemoteInt)。(I1d416
  • 更新了 RemoteText 以使用 RemoteFontFamily 而不是 FontFamilyIb76b6b/502907551
  • 添加了修饰符 alpha、旋转和缩放。(I5d682b/505427444)

版本 1.0.0-alpha010

2026 年 5 月 6 日

发布了 androidx.compose.remote:remote-*:1.0.0-alpha010。版本 1.0.0-alpha010 中包含这些提交内容

功能

  • 添加了 EnforceCleanRecomposition 标志 (I6e4408)。为了支持 RemoteCompose 中的重组,我们阻止了在组合完成之前向文档写入任何内容。这样可以防止文档在重组期间被部分写入。如果此行为导致现有代码出现问题,可以通过将 isEnforceCleanRecompositionEnabled 设置为 false 来停用此行为。

API 变更

bug 修复

  • 修复了将 RemoteColor(而不是静态颜色)用作背景颜色时的背景剪辑问题(If70842b/505116577
  • 支持为从 URI 加载的位图提供显式大小。之前,系统会将大小计算为 1x1,并将该像素缩放到容器大小(Id4fffb/487936996
  • 防止在没有 SensorManager 的设备上出现崩溃 bug (I1fc947b/498302479)
  • 修复了 TIME_FROM 表达式不使用提供的时钟(阻止对时长表达式进行可靠测试)的问题(I5f816b/501405389

版本 1.0.0-alpha09

2026 年 4 月 22 日

发布了 androidx.compose.remote:remote-*:1.0.0-alpha09。版本 1.0.0-alpha09 中包含 这些提交内容

API 变更

  • 修饰符 clickable 已更改为不接受操作参数的 null 值。应改用 Action.Empty。(I21be9b/498881738
  • 内边距修饰符参数已从左/右更改为开始/结束。(Id781cb/500760020
  • 修饰符 onTouchDown(varargs action)onTouchUp(varargs action) 已更改为 onTouchDown/onTouchUp(action)。对于操作列表,请使用 CombinedAction。(I8af9db/498881738)
  • 修饰符 clickable(varargs action) 已更改为 clickable(action)。对于操作列表,请使用 CombinedAction。(I8432db/498881738)

bug 修复

  • 修复了 MatrixExpression.write (Id3c52)

版本 1.0.0-alpha08

2026 年 4 月 8 日

发布了 androidx.compose.remote:remote-*:1.0.0-alpha08。版本 1.0.0-alpha08 中包含 这些提交内容

新功能

  • CoreTextTextStyleTextTransformColorTheme 操作提升为基准 AndroidX 和 Widget 配置文件(I69671b/494482597
    • CoreText 提供了更丰富的功能来呈现文本,包括自适应文本大小调整,以及对文本布局功能(如换行和溢出行为)的改进控制。
    • TextStyle 允许在文档中捕获一次常见的文本样式属性,并由多个文本运行引用。
    • TextTransform 支持文本转换,例如将文本转换为大写。
  • 当布局方向为从右到左 (RTL) 且不使用绝对水平排列时,反向呈现水平布局中的项。(I2d38e)

API 变更

  • 首选 toRemoteString(DecimalFormat) 作为开发者 API。(Ia4925b/493924433
  • 移除了修饰符 clip(shape, size)。应改用修饰符 clip(shape)。(I76301)

bug 修复

  • 更新了 TextLookup 以跟踪数组元素更改。这样可确保如果表达式在数组中查找的元素发生更改,表达式将重新评估(I162c7

版本 1.0.0-alpha07

2026 年 3 月 25 日

发布了 androidx.compose.remote:remote-*:1.0.0-alpha07。版本 1.0.0-alpha07 中包含 这些提交内容

新功能

  • 实现了非线性字体缩放 (73b23c0)
  • 使布局能够识别 LayoutDirection (81f984b)

API 变更

版本 1.0.0-alpha06

2026 年 3 月 11 日

发布了 androidx.compose.remote:remote-*:1.0.0-alpha06。版本 1.0.0-alpha06 中包含 这些提交内容

新功能

  • TextStyle 添加了新的实验性操作。TextStyle 支持将常用排版样式写入文档一次,并由多个文本运行重复使用 (bfc6487)

API 变更

  • 公开了 RemoteTextStyle 合并(I971ceb/446824085
  • RemotePainter 作为公共 API 公开(I252c1b/446824085
  • 公开了 Border/Clip 修饰符和 RemoteShape。(Id26ddb/446824085
  • remote-creation-compose 中公开了 RemoteColor API(I4ab00b/446824085
  • 公开了 RemoteText API (I6b019)
  • 公开了 RemoteImage API(Ided31
  • 公开了 RemoteBooleanRemoteStringRemoteFloat API(Id9ee6
  • 来自 WidthIn 注释的远程可组合项(I80784

bug 修复

  • 将库移至使用 Java 11 目标。这意味着生成的字节码将是 Java 11(类文件版本 55),可能需要进行 desugaring 才能使用该库(If4c2ab/457821470
    • 确保长度和 textlookup 正确更新。之前,系统会在第一帧计算 RemoteStrings 的长度,之后不会更新(e49cb53
    • 支持具有较大分数组件的数字的 TextFromFloat。之前,较大的“digitsAfter”值可能会导致浮点数评估为 0 (5080bc54)

版本 1.0.0-alpha05

2026 年 2 月 25 日

发布了 androidx.compose.remote:remote-*:1.0.0-alpha05。版本 1.0.0-alpha05 中包含 这些提交内容

新功能

  • 推出了 fillParentMaxWidthfillParentMaxHeight。(4c6d77c

API 变更

  • 公开了常见的远程可组合项和修饰符类型 (Id1d40)
  • 公开了 RemoteState 的类型(I22429b/465453482

bug 修复

  • 修复了滚动问题 (0a25299)
  • 修复了触摸斜率问题 (0192b69)
  • 在渲染过程的早期设置了密度,以便在第一帧(通常在屏幕截图测试中捕获)上正确应用密度 (f775399)

版本 1.0.0-alpha04

2026 年 2 月 11 日

发布了 androidx.compose.remote:remote-*:1.0.0-alpha04。版本 1.0.0-alpha04 中包含 这些提交内容

新功能

  • 默认启用使用 RemoteApplier,这样可以防止在创建远程界面时使用非远程可组合函数。可以通过更改 RemoteComposeCreationComposeFlags 中的 isRemoteApplierEnabled 来停用此功能。(67a405f
  • 为位图字体添加了字形间距 (0852657)
  • RemoteCanvas 中使用轴心旋转 (9a292b3)
  • 添加了 RemoteSpacer (12beb72)
  • 避免了 java.time 依赖项,从而允许将创建库的 minSdk 降低到 23 (59e30d0)
  • FlowLayout (7efef02)

bug 修复

  • 修复了非全局 ColorExpression 和计算出的字符串的评估。(c08d0bd

外部贡献

  • androidx.compose.ui.graphics.NativePaint 类型别名已废弃,请直接使用 android.graphics.PaintI6303cb/477394763
  • Paint.asFrameworkPaint() 替换为 Paint.nativePaint 扩展,以避免通过 typealias 将平台类型公开到 commonMain 源集(I6303cb/477394763

版本 1.0.0-alpha03

2026 年 1 月 28 日

发布了 androidx.compose.remote:remote-*:1.0.0-alpha03。版本 1.0.0-alpha03 中包含 这些提交内容

新功能

  • 支持 BorderModifier 0afd343 中的不同形状和 RemoteColors
  • 添加了 CombinedAction 以支持点击事件中的多个操作 10e16a2

API 变更

  • 迁移了 RemoteColorRemoteBitmap 的 API 以使用 Compose 类型,而不是直接公开 Android 类型 a9bfbb8
  • 引入了 RemoteDensity 类型,以允许确定是在播放器上评估密度(为远程设备生成文档时),还是内联表达式(以优化同一设备上的文档大小) 54352bb
  • RemoteState constantValueOrNull 重命名(I6ad5cb/467050397

版本 1.0.0-alpha02

2026 年 1 月 14 日

发布了 androidx.compose.remote:remote-*:1.0.0-alpha02。版本 1.0.0-alpha02 中包含 这些提交内容

新功能

  • 为 CoreText 添加了最小/最大字体大小。I7bd3c

API 变更

bug 修复

  • 修复了重新布局后的滚动位置 + 添加了对边缘效果的支持 (6d4551)

版本 1.0.0-alpha01

2025 年 12 月 17 日

发布了 androidx.compose.remote:remote-*:1.0.0-alpha01。版本 1.0.0-alpha01 中包含 这些提交内容

  • 远程 Compose 是一个用于为远程 surface 创建界面的框架。