ConstraintLayout有三种大小设置模式:
spread(默认:拉伸)
wrap(自适应)
percent(百分比)
可通过app:layout_constraintWidth_default、app:layout_constraintHeight_default设置
此时android:layout_width、android:layout_height都需设置为0dp
1.spread模式
此模式为默认模式,表示约束条件下的最大尺寸。 用法:
......
app:layout_constraintStart_toEndOf="@+id/ivNav"
app:layout_constraintEnd_toStartOf="@+idrent"
android:layout_width="0dp"
......" />
2.wrap模式
自适应大小,但又不超过约束条件下的最大尺寸,常用在Toolbar中间的标题设置。 用法(左View为ivNav,右View为ivEnd,文本在中间显示且末尾缩略):
android:id="@+id/tvT"
android:text="我是一个长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长"
android:textSize="19sp"
android:textColor="#FFFFFF"
android: