diff options
-rw-r--r-- | core/src/main/kotlin/ca/allanwang/kau/utils/ViewUtils.kt | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/ViewUtils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/ViewUtils.kt index 4757a00..556c01c 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/utils/ViewUtils.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/utils/ViewUtils.kt @@ -88,6 +88,15 @@ inline val View.isInvisible: Boolean inline val View.isGone: Boolean get() = visibility == View.GONE +/** + * Measure the height of a view if it had match_parent for width and no height restrictions + */ +inline val View.unboundedHeight: Int + get() { + measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED) + return measuredHeight + } + @KauUtils inline fun View.setBackgroundColorRes(@ColorRes color: Int) = setBackgroundColor(context.color(color)) |