Skip to main content
InterviewHubPRO
Section Overview
Q49

Question 49 of 50

Part 3: ART Internals, Memory Leak Profiling & Production Hardening (25 - 35)

98%
Android & Jetpack Compose (50 Qs)•Part 3: ART Internals, Memory Leak Profiling & Production Hardening (25 - 35)

Custom Views and Custom Modifiers in Compose: Layout phase and MeasurePolicy.

senior LevelCode ExamplePerformanceMemory ManagementDocker & Containers

In Simple Words: Building custom layout algorithms in Compose:

  • Three Phases of Compose: Composition (What to show), Layout (Where to place), and Drawing (How to render).
  • Custom Layout Composable:
    kotlin
    Layout(content = content) { measurables, constraints ->
      val placeables = measurables.map { it.measure(constraints) }
      layout(width, height) {
        placeables.forEach { it.placeRelative(x, y) }
      }
    }
    
  • Allows building custom staggered grids, circular layouts, and responsive flow rows.