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

Maciej Pigulski

02/22/2021, 2:41 PM
Is it just me or
Column(modifier = Modifier.fillMaxSize())
is overriding background set in
Colors(..., background = Color.Red, ...)
for the Material Theme. Not sure if it is strictly
Column
releated but if I remove it from the view hierarchy I am able to see
Color.Red
as the background.
Column
that I am removing has no background of its own. I fail to pinpoint if there is some material color that is taken by default for
Column
background. I have checked the source code and couldn't find any defaults taken f.e. from
colorPrimary
or else. Now I see it as a bug but maybe I got something wrong..
b

Bryan Herbst

02/22/2021, 2:55 PM
What is the content of your
Column
?
m

Maciej Pigulski

02/22/2021, 2:55 PM
There is some content, but I am testing without any content.
Just plain column stretched to the edges for testing purposes.
b

Bryan Herbst

02/22/2021, 2:57 PM
What does your full tree of Composables look like? I.e. what is this
Column
in?
m

Maciej Pigulski

02/22/2021, 2:58 PM
A lot of other stuff there but they do not cover the background in my opinion because as soon as I remove the Column I can see the background so it seems that items up the tree do not affect the background. Anyways, to sum up this is rather an odd behaviour and rather not happening in general but related to my setup and I should debug more?
I might setup some side project for testing this.
b

Bryan Herbst

02/22/2021, 3:02 PM
I’m guessing it is related to your particular setup. You are correct that Column does not set a background of any sort by itself, and it has no references to Material. Column is part of the foundation library and is thus unaware of any sort of specific design system implementation such as Material. Things I’d be looking at would be whether I’m using a
Surface
or a
Scaffold
somewhere, and where that is. Those are the types of Composables (from
androidx.compose.material
) that tend to utilize properties like the background color
👌 1