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

906
Views
Wrap text to next line using Jetpack Compose

enter image description hereI've created a constraint layout

 ConstraintLayout(
        Modifier
            .fillMaxWidth()
            .wrapContentHeight()
    ) {

        Image(
            painter = rememberImagePainter(it.photoUrl.toString()),
            modifier = Modifier
                .constrainAs(photo) {
                    start.linkTo(parent.start, margin = 30.dp)
                    top.linkTo(parent.top, margin = 30.dp)
                }
                .width(130.dp)
        )

        Column(
            modifier = Modifier
                .constrainAs(holder) {
                    start.linkTo(photo.end, margin = 30.dp)
                    top.linkTo(photo.top)
                    bottom.linkTo(photo.bottom)
                    end.linkTo(parent.end, margin = 30.dp)
                }
                .fillMaxWidth()
                .wrapContentHeight(),
            horizontalAlignment = Alignment.CenterHorizontally
        ) {
            Text(
                modifier = Modifier
                    .wrapContentWidth()
                    .wrapContentHeight(),
                text = "Lorem Ipsu auto text  ator..."
            )
}

As you can see long text can not fit in layout. How Can I wrap text to next line? I tried to change wrapContentWidht() to fillMaxParentWidth but id didn't help.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You can use width = Dimension.fillToConstraints to limit the width to the available space.

within the constrainAs block

In your example:

.constrainAs(holder) {
   start.linkTo(photo.end, margin = 30.dp)
   top.linkTo(photo.top)
   bottom.linkTo(photo.bottom)
   end.linkTo(parent.end, margin = 30.dp)
   width = Dimension.fillToConstraints
}
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!