简体   繁体   中英

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

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?

在此处输入图像描述

Thanks

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 {
             ...
        }
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM