android-jetpack-composeandroid-jetpack

Unable to make a custom Widget occupy space while native Widgets like Row, Text work fine


I want to make a static grid where each quadrant takes equal space.

When I use native widgets like Text or Row they work fine. But when I am using my own widget ( which is simple ) it doesn't work.

Using Custom Widget with UI

Using Custom Widget with UI

Using native widget with UI

Using native widget with UI

Custom widget

Custom widget


Solution

  • You didn't apply the modifier

    @Composable
    fun Quadrant(
      modifier: Modifier,
    ) {
      Column(modifier) { // <-- here
      }
    }