View is pushed out of its constraints in ConstraintLayout

前端 未结 1 788
时光说笑
时光说笑 2021-01-19 13:44

I have a ConstraintLayout with an ImageView and 3 chained TextViews with a spread_inside chain style:



        
相关标签:
1条回答
  • 2021-01-19 14:29

    A change made in version 1.1 of ConstraintLayout may help you. Try setting app:layout_constrainedHeight=”true” on your troublesome TextView. From the developer guide for ConstraintLayout:

    WRAP_CONTENT : enforcing constraints (Added in 1.1)

    If a dimension is set to WRAP_CONTENT, in versions before 1.1 they will be treated as a literal dimension -- meaning, constraints will not limit the resulting dimension. While in general this is enough (and faster), in some situations, you might want to use WRAP_CONTENT, yet keep enforcing constraints to limit the resulting dimension. In that case, you can add one of the corresponding attribute:

    app:layout_constrainedWidth=”true|false”
    app:layout_constrainedHeight=”true|false”

    0 讨论(0)
提交回复
热议问题