Hey..I just started learning compose...how can we ...
# compose
g
Hey..I just started learning compose...how can we set color in spacer.....I want to have a 30 dp space with white color....by default it is coming black color....it tried setting spacer.background(white) but not working....suggest any way to do so...thanx
Or we can do it without using spacer...like in XML we had view which just leave desired space..... something like that in compose?
f
This should work:
Copy code
Spacer(modifier = Modifier
    .size(30.dp)
    .background(Color.White))
1
g
Yess @Foso it worked...thanx😊 I made a mistake i.e
Copy code
modifier.background(white).
height(30.dp).fillmaxheight()
...while I should have done
fillmaxwidth....
due to this color was not coming....these little mistakes😅😅
👍 1
f
Shouldn't Space be transparent by default? I think that if you want background, you should use Box instead.
👍 1