View is pushed out of its constraints in ConstraintLayout

£可爱£侵袭症+ 提交于 2019-12-01 23:43:30

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”

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!