Search code examples
androidkotlinandroid-jetpack-composeandroid-jetpack-compose-material3

How to change the drawer container color of ModalNavigationDrawer in Jetpack Compose?


I just updated material3 dependency to:

implementation "androidx.compose.material3:material3:1.0.0-alpha16"

And:

drawerContainerColor = Color.Red

Doesn't work anymore. I tried to set:

scrimColor = Color.Red

But the color is not changed? How to change the content color?


Solution

  • You can use drawerContainerColor in the ModalDrawerSheet

    ModalNavigationDrawer(
        drawerState = drawerState,
        drawerContent = {
            ModalDrawerSheet (drawerContainerColor=Red){
                //..
            }
        }
        //...
     )
    

    enter image description here