How to change system navigation bar color

后端 未结 8 1691
故里飘歌
故里飘歌 2020-12-08 02:17

In guidelines of Android 5.0, the navigation bar seems customizable: http://www.google.com/design/spec/layout/structure.html#structure-system-bars

H

相关标签:
8条回答
  • 2020-12-08 02:47

    Use this in your Activity.

     if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            getWindow().setNavigationBarColor(getResources().getColor(R.color.green));
        }
    
    0 讨论(0)
  • 2020-12-08 02:48

    You can also set light system navigation bar in API 26 programmatically:

    View.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
    

    Where View coluld be findViewById(android.R.id.content).

    However remember that:

    For this to take effect, the window must request FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS but not FLAG_TRANSLUCENT_NAVIGATION.

    See documentation.

    0 讨论(0)
提交回复
热议问题