问题
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