Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

177
Vistas
How can we define a column with padding and just one item doesn't inherit the padding of the column in Jetpack Compose?

I have a column with many items, and I want to set the padding for the column because all items have the same padding except one of them which doesn't have padding, how can I consider an exception for that specific item? Or is it possible to add an attribute that says don't get your parent padding? I know I can remove padding for column and add one by one, but I want to ask anybody knows that, is there any other way?

Column(
        modifier = Modifier
            .fillMaxSize()
            .verticalScroll(rememberScrollState()),
            .padding(16.dp),
        verticalArrangement = Arrangement.spacedBy(16.dp)
    ) {
 Text(text = "Teaser1")

Text(text = "Teaser2")

Text(text = "Teaser3")

Text(text = "Teaser")

Text(text = "Teaser4")

Text(text = "Teaser5")

...

}

Thank you in advance for your help.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

You can use Modifier.layout.

I override the width constraint by adding padding for measure, and applying the padding offset during place.

Text(
    text = "Teaser",
    modifier = Modifier
        .layout { measurable, constraints ->
            val noPaddingConstraints = constraints.copy(
                maxWidth = constraints.maxWidth + (padding * 2).roundToPx()
            ) 
            val placeable = measurable.measure(noPaddingConstraints)
            layout(placeable.width, placeable.height) {
                placeable.place(x = -padding.roundToPx(), y = 0)
            }
        }
)
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda