Intrinsic Measurements In Jetpack Compose.
In this article we will be talking about intrinsic measurements in Jetpack Compose.
Let’s breakdown both the term intrinsic
& measurements
.
Measurements
In the context of Jetpack Compose and other layout systems, “measure” refers to the process of determining how much space a Child UI element (e.g., a composable) should occupy within a Parent layout.
Intrinsic
Intrinsic , lets get some information about the child composable functions before measuring them.
However there are times when you need some information about the children before they rendered on the UI.
It is of two types :-
- (min|max)IntrinsicWidth — it will calculate the minimum and maximum width of child composable function.
- (min|max)IntrinsicHeight — it will calculate the minimum and maximum height of child composable function.
Suppose I want to make above thing in jetpack compose , so for that we will use two text composable functions separated by divider and In case of divider width will be 1.dp that’s fine but height will be any random number. But when the size of Text1 & Text2 increases , divider will look very weird.