【问题标题】:How to align elements using ConstraintLayout Flow如何使用 ConstraintLayout Flow 对齐元素
【发布时间】:2021-03-02 20:11:54
【问题描述】:

我正在使用 ConstraintLayout Flow 想要创建如下布局

但无法使用 ConstraintLayout Flow 实现上述目标,我的布局如下所示

下面是我的代码

        <androidx.constraintlayout.helper.widget.Flow
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/imgAiport"
        app:constraint_referenced_ids="tvDateLbl,tvTimeLbl,tvAirlineLbl,tvDate,tvTime,imgAirlineLogo"
        app:flow_wrapMode="aligned"
        android:layout_margin="15dp"
        app:flow_maxElementsWrap="3"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/>

如何使用 ConstraintLayout Flow 正确对齐元素

【问题讨论】:

    标签: android android-layout android-xml android-constraintlayout androidx


    【解决方案1】:

    我认为这里唯一的选择是将所有这些TextView's 设置为一个宽度大小,并以文本重力开始。

    【讨论】:

    • 嘿,感谢您从所有子项中删除 wrap_content 宽度并保持宽度 0dp 现在按预期工作的线索。你能改变你的答案以便我接受吗
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-09-30
    • 2021-09-15
    • 1970-01-01
    • 1970-01-01
    • 2017-08-25
    • 2021-01-03
    相关资源
    最近更新 更多