Questions tagged [android-jetpack-compose-layout]

62 questions
10
votes
1 answer

Jetpack Compose Constraint Layout constrains not linking

I'm using constrainAs with Jetpack Compose to constrain a list of wifi options to the top of the parent and then to the bottom of a text view. As seen from the photo my list isn't being constrained to the top of the parent or to the textview below…
9
votes
1 answer

How to align a Text and Icon Composable so that they stay together even after text overflow?

I have a Text and an Icon composable. I want the icon to stick to the right of composable. This is the code I have: Row( verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.Center, modifier = Modifier …
9
votes
1 answer

Align Box/Column to bottom of screen Jetpack Compose

I essentially want cards pinned to the top with a group of buttons pinned to the bottom (on screen keyboard) Using Column with a modifier like so only leads to the buttons covering the top cards: fun HomeScreen() { Column( modifier = Modifier …
7
votes
5 answers

Can't represent a size of 214748364 in Constraints

I just created a simple Composable and wished to render it using a Layout, but while implementing the solution, I stumbled upon this error in the measurement phase. java.lang.IllegalArgumentException: Can't represent a size of 214748364 in…
5
votes
2 answers

Text layout priority in Jetpack Compose

I have two texts in a row: Row { Text( "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi…
Phil Dukhov
  • 67,741
  • 15
  • 184
  • 220
4
votes
2 answers

Compose elements not overlapping

I am trying to overlap two different compose elements. I want to show a toast kind of message at the top whenever there is an error message. I don't want to use a third party lib for such an easy use case. I plan to use the toast in every other…
4
votes
2 answers

RecyclerView jumps when scrolling variable height ComposeView items

I have a RecyclerView that's hosting items rendered with Jetpack Compose. The height of the items varies. When scrolling from the top of the list to the bottom, scrolling is smooth. However, when scrolling back to the top, the items in the list jump…
4
votes
3 answers

Create vertical chain with respect to other element in jetpack compose ConstraintLayout?

I want to chain title and description text centered with respect to image with chainStyle.Packed how to achieve this in jetpack compose. when i use createVerticalChain() its create chain with respect to parent container that's not what i want, is…
4
votes
2 answers

Jetpack Compose align Row/Column children relative to each other

Is there an easy way, without resorting to manual layout or constraint layout, to align children of a Column/Row relative to each other, independently of the Column/Row content alignment? This what I'm trying to achieve: having a Column that aligns…
4
votes
2 answers

Icons getting disappears if the text is too long in Jetpack Compose

@Composable fun TopAppBar( name: String, modifier: Modifier = Modifier ) { Row( modifier = modifier .fillMaxWidth() .padding(20.dp, 0.dp), verticalAlignment = Alignment.CenterVertically, …
3
votes
2 answers

How to Align the Icon to the End in TopAppBar jetpack compose

Now the icon always in the start, what should I do to align the icon to the end? I tried to use modifier but doesn't work. Thank you in advance.
3
votes
1 answer

How to implement vertical likert scale with jetpack compose

I am attempting to create a vertical Likert scale using Jetpack Compose. Each field should include a vertical line that extends beyond its boundaries. I have also included an image to give an idea of what I am trying to achieve.
3
votes
1 answer

TextField overflow and softwrap not working with Compose Constraint Layout

I've been trying to build a list with a Card in it formatted like this: The difficulty here is that the title e.g. "Bread" and ingredient name e.g. "Flour" can be very long and thus I want to have an ellipsis to keep things manageable i.e. "My Long…
2
votes
0 answers

Jetpack compose DropDownMenu position inside a surface not showing

I have a surface (which acts like a card) and at the right top corner I have menu dots. The idea is that when a user taps the menu dots a drop down menu should appear. The issue I have is that the dropdownmenu is only shown if the surface is large…
2
votes
2 answers

Align row item in jetpack compose

I want to make row like this Expected Output AND I tried this piece of code DividerWithItem @Composable fun DividerWithItem( modifier: Modifier = Modifier, index: () -> Int, itemName: String, lastIndex: () -> Int, …