Thread
#compose
    g

    Gaurav

    1 year ago
    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?
    Foso

    Foso

    1 year ago
    This should work:
    Spacer(modifier = Modifier
        .size(30.dp)
        .background(Color.White))
    g

    Gaurav

    1 year ago
    Yess @Foso it worked...thanx😊 I made a mistake i.e
    modifier.background(white).
    height(30.dp).fillmaxheight()
    ...while I should have done
    fillmaxwidth....
    due to this color was not coming....these little mistakes😅😅
    Filip Wiesner

    Filip Wiesner

    1 year ago
    Shouldn't Space be transparent by default? I think that if you want background, you should use Box instead.