diff --git a/vector/src/main/java/im/vector/app/core/extensions/ConstraintLayout.kt b/vector/src/main/java/im/vector/app/core/extensions/ConstraintLayout.kt index 46d173b848..b88e315978 100644 --- a/vector/src/main/java/im/vector/app/core/extensions/ConstraintLayout.kt +++ b/vector/src/main/java/im/vector/app/core/extensions/ConstraintLayout.kt @@ -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() { doOnLayout { val rootHeight = (parent as View).height