ConstraintLayout子View android:minHeight 無效解決

當父類是ConstraintLayout時
子view設置

	 android:layout_height="wrap_content"
	 android:minHeight="40dp"

無效,疑似爲自定義View沒有做minHeight的適配,TextView如此寫就可以實現最小高度的限制
但是如下設置,則可以實現最小高度的效果

	android:layout_height="wrap_content"
	app:layout_constrainedHeight="true"
	app:layout_constraintHeight_min="40dp"

同理寬度只要將height換成width即可
最大寬度/高度效果應該也可以這樣實現

app:layout_constraintHeight_max

我沒測試,請自己嘗試看下

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章