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

如何在Compose Multiplatform中使用ConstraintLayout?

在 Compose Multiplatform 中使用 ConstraintLayout 的配置方法

要在 Compose Multiplatform 项目中使用 ConstraintLayout,需先在commonMain的依赖配置中添加对应依赖,具体配置代码如下:

commonMain.dependencies {
    implementation(compose.runtime)
    implementation(compose.foundation)
    implementation(compose.material)
    implementation(compose.ui)
    implementation(compose.components.resources)
    implementation(compose.components.uiToolingPreview)
    implementation("androidx.constraintlayout:constraintlayout-compose:1.0.1")
}

添加完成后,即可在项目的 common 模块中使用 ConstraintLayout 组件构建跨平台布局。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.21 01:10:56