請檢查是否有主題強制操作首先你申請你自己的風格之後,尤其是來電applyStyle/setTheme的。
colorPrimaryDark不能工作,雖然Theme.Settings已設置windowDrawsSystemBarBackgrounds因爲在PhoneWindow.java和ActivityManager.java下面的代碼:
// PhoneWindow.java
protected ViewGroup generateLayout(DecorView decor) {
// Non-floating windows on high end devices must put up decor beneath the system bars and
// therefore must know about visibility changes of those.
if (!mIsFloating && ActivityManager.isHighEndGfx()) { // Shield off this flag if isFloating or lowEndGfx
if (!targetPreL && a.getBoolean(
R.styleable.Window_windowDrawsSystemBarBackgrounds,
false)) {
setFlags(FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS,
FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS & ~getForcedWindowFlags());
}
}
...
}
private WindowInsets updateColorViews(WindowInsets insets, boolean animate) {
if (!mIsFloating && ActivityManager.isHighEndGfx()) {
...
}
...
}
// ActivityManager.java
static public boolean isHighEndGfx() {
return !isLowRamDeviceStatic() &&
!Resources.getSystem().getBoolean(com.android.internal.R.bool.config_avoidGfxAccel);
}
/** @hide */
public static boolean isLowRamDeviceStatic() {
return "true".equals(SystemProperties.get("ro.config.low_ram", "false"));
}
我只是改變其不檢查ロPhoneWindow的政策。 config.low_ram屬性來快速實現我的預期。
'@ color/red'的值是多少? –
我會盡快調查。 –