Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

164
Views
One of Row items is not displayed in Jetpack Compose view

Here's a test composable:

@Preview
@Composable
fun SliderInRow() {
    Row {
        Text("qwe")
        Slider(value = 0f, onValueChange = {})
        Text("wer")
    }
}

I want a row with a text, a slider and another text. However, the last text composable (wer) is missed:

enter image description here

What am I doing wrong?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Slider is designed to take all width available, same as any view with Modifier.fillMaxWidth does.

That's why he compresses the last view and makes it zero width.

The recommended way to create such a layout is to add Modifier.weight(1f) to the flexible view, Slider in you case. From its documentation:

The parent will divide the horizontal space remaining after measuring unweighted child elements and distribute it according to this weight.

Row {
    Text("qwe")
    Slider(value = 0f, onValueChange = {}, modifier = Modifier.weight(1f))
    Text("wer")
}
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!