简体   繁体   中英

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.

Try with aspectRatio , you need to import

import androidx.compose.foundation.layout.aspectRatio

and then use it as follow

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM