繁体   English   中英

layout_constraintHeight_default="wrap" 没有正确包装 TextView

[英]layout_constraintHeight_default="wrap" not correctly wrapping TextView

在匹配约束时,我无法让一些视图环绕到正确的高度,我设法将我的问题浓缩为单个文本视图。

出于某种原因,当我使用 layout_constrainedWidth 和 layout_constrainedHeight 时,它们无法处理几乎没有换行到下一行的文本视图。

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/coordinator_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

        <TextView
            android:id="@+id/textView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="32dp"
            android:layout_marginTop="8dp"
            android:layout_marginEnd="64dp"
            android:layout_marginBottom="8dp"
            android:text="If a single word wraps onto the next line it is cut off one"
            android:visibility="visible"
            app:layout_constrainedHeight="true"
            app:layout_constrainedWidth="true"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

</android.support.constraint.ConstraintLayout>

我实际上是在包含一些文本视图的滚动视图上使用它,除非我也将它应用于子视图,否则它根本不起作用。

这是Android中的错误吗?

是的,这是Android中的一个错误。

https://issuetracker.google.com/issues/123551995

随着 ConstraintLayout 2.0 beta 2 的发布,Google 将其标记为已解决

暂无
暂无

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

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