How do I change the color of soft keys to white in android(Navigation buttons)

假如想象 提交于 2019-12-07 10:47:25

问题


I am making a basic launcher app where i needed my notification bar and status bar to be perfectly transparent. So i used below code.

Window w = getWindow(); // in Activity's onCreate() for instance
w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);

Which does the trick but the color of the softkeys is not white as shown in figure below.

How do i make it white?


回答1:


Ok finally solved it in lollipop. But i haven't tested in devices lower than lollipop.

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        Window window = getWindow();
        window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        window.setStatusBarColor(Color.TRANSPARENT);
        window.setNavigationBarColor(Color.TRANSPARENT);
    }



回答2:


It seems to be impossible for now. At least, on non-rooted device. These buttons show pre-defined images from ROM (part of part of com.android.systemui).

There's a discussion about theming softkeys on XDA-Developers

The only real thing you can do is to choose between Light and Dark theme:

(Taken from https://www.google.com/design/spec/layout/structure.html#structure-system-bars)

I won't be surprise if it changes in the future SDKs, though..



来源:https://stackoverflow.com/questions/34469998/how-do-i-change-the-color-of-soft-keys-to-white-in-androidnavigation-buttons

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!