简体   繁体   English

如何使用 jetpack compose 为 ConstraintLayout 提及 dimensionRation?

[英]How to mention dimensionRation for ConstraintLayout with jetpack compose?

We have app:layout_constraintDimensionRatio for ConstraintLayout while using in with XML. Likewise, how to use dimensionRatio with jetpack compose.在与 XML 一起使用时,我们有app:layout_constraintDimensionRatio用于 ConstraintLayout。同样,如何将 dimensionRatio 与 jetpack compose 一起使用。

Try with aspectRatio , you need to import尝试使用aspectRatio ,你需要导入

import androidx.compose.foundation.layout.aspectRatio

and then use it as follow然后按如下方式使用它

Box(modifier = Modifier.aspectRatio(0.5f))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Jetpack compose 中的 ConstraintLayout 问题 - Issue with ConstraintLayout in Jetpack compose 如何将 Jetpack Compose ConstraintLayout 与 Column 一起使用 - How to use Jetpack Compose ConstraintLayout together with Column ConstraintLayout 中的 ConstraintLayout 在 Jetpack Compose 中不起作用 - ConstraintLayout inside ConstraintLayout not working in Jetpack Compose Jetpack Compose 中的 ConstraintLayout 剪辑不起作用 - Clip in ConstraintLayout in Jetpack Compose not working 在 ConstraintLayout 中使用 Jetpack Compose 垂直滚动组件 - Use Jetpack Compose vertically scrollable component in ConstraintLayout 如何测试 Jetpack Compose? - How to test Jetpack Compose? ConstraintLayout 与 Jetpack Compose 中的 LazyRow 不兼容 - ConstraintLayout doesn't quite work with LazyRow in Jetpack Compose Jetpack Compose 中是否有类似 ConstraintLayout 的“dimensionRatio”属性? - Is there something like ConstraintLayout's "dimensionRatio" property in Jetpack Compose? ConstraintLayout 是否仍然优于 Jetpack Compose 中的嵌套列和行? - Is ConstraintLayout still preferred over nested Column & Row in Jetpack Compose? 我应该在 Android Jetpack Compose 中使用 ConstraintLayout 以获得更好的性能吗? - Should I use ConstraintLayout in Android Jetpack Compose for a better performance?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM