mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-16 02:05:06 +08:00
adding docs around the realigning of constraint layout child percentages
This commit is contained in:
parent
468a81e1c3
commit
c45c421e48
@ -31,6 +31,11 @@ fun ConstraintLayout.updateConstraintSet(block: (ConstraintSet) -> Unit) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper to recalculate all ConstraintLayout child views with percentage based height against the parent's height.
|
||||||
|
* This is helpful when using a ConstraintLayout within a ScrollView as any percentages will use the total scrolling size
|
||||||
|
* instead of the viewport/ScrollView height
|
||||||
|
*/
|
||||||
fun ConstraintLayout.realignPercentagesToParent() {
|
fun ConstraintLayout.realignPercentagesToParent() {
|
||||||
doOnLayout {
|
doOnLayout {
|
||||||
val rootHeight = (parent as View).height
|
val rootHeight = (parent as View).height
|
||||||
|
Loading…
Reference in New Issue
Block a user