Home > database >  How to change the color of the icons in the navigation bar in Jetpack Compose?
How to change the color of the icons in the navigation bar in Jetpack Compose?

Time:01-17

I have modified the color of the navigation bar to put a lighter color:

<item name="android:navigationBarColor" tools:targetApi="1">@color/navigation_bar</item>

Now the problem is that the icons on the bar are still blank so they are hardly visible. How can you change the color of these icons?

enter image description here

Thanks

CodePudding user response:

Because your navigation bar is light, you can use this function to make the icon on navigation bar easy to see

class MainActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        WindowInsetsControllerCompat(window, window.decorView).isAppearanceLightNavigationBars = true
        setContent {
             ...
        }
    }
}
  •  Tags:  
  • Related