https://kotlinlang.org logo
#compose
Title
# compose
r

Rafal

10/25/2019, 11:18 AM
Hello, how can I create rectangle shape with
width=4dp
and
height=match_parent
in compose?
Copy code
Container(width = 4.dp, expanded = true) {
      DrawShape(shape = RectangleShape, color = Color.Black)
}
this doesn’t seem to work
m

Mihai Hrincescu

10/25/2019, 11:26 AM
Well
Container
will expand to fill it's parent if possible so it will depend what layout wraps the container.
r

Rafal

10/25/2019, 11:27 AM
this is my layout
m

Mihai Hrincescu

10/25/2019, 11:31 AM
I'm not sure what behaviour you expect.
r

Rafal

10/25/2019, 11:34 AM
actually, a simple vertical line that expands with the title width
m

Mihai Hrincescu

10/25/2019, 12:43 PM
There seems to be a bug with the
Container
and
DrawShape
because this works
And this does not
In the second example the width is taken by the
container
but my guess is that the
height
is set to 0. I need to check if is indeed the case.
a

Andrey Kulikov

10/25/2019, 1:58 PM
could you please try to wrap your Row in MinIntrinsicHeight component and add this param for Row: crossAxisAlignment = CrossAxisAlignment.Stretch
👍 2
p

pavi2410

10/25/2019, 4:20 PM
@Rafal You could instead set border left if possible. That would be much simple
r

Rafal

10/28/2019, 9:42 AM
@Andrey Kulikov your solution worked, thanks!
5 Views