Constraint Compose中有重力参数吗?

问题描述 投票:0回答:0

在 Android XML 方法中,我们曾经有一个重力参数,我们可以使用该参数在宽度指定为 0dp 的约束布局内指定项目的重力。在这种情况下,textView 可以扩展到结束约束,并通过将重力指定为开始或中心,文本将填充在那里。这是一个 textView 广告代码示例。

    <TextView
        android:id="@+id/tv_body"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:gravity="center"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toEndOf="@id/view_line"
        app:layout_constraintTop_toTopOf="parent"
        tools:text="@tools:sample/lorem" />

像上面的代码一样,我们可以使用重力。但我在 Constraint Compose 中找不到与此类似的内容。官方 Documentation 也没有具体说明。如果有人知道 Constraint compose 中有什么东西,他们可以帮助我吗?我已经尝试过行方法。我们可以在哪里使用 Alignment ,但这需要 textView 位于 Row 或 Box Scope 内。我只是想知道是否有实现这种行为的约束方法。

android android-studio kotlin android-jetpack-compose android-constraintlayout
© www.soinside.com 2019 - 2024. All rights reserved.