下面列出了android.content.pm.ActivityInfo#ColorMode() 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* <p>Sets the requested color mode of the window. The requested the color mode might
* override the window's pixel {@link WindowManager.LayoutParams#format format}.</p>
*
* <p>The requested color mode must be one of {@link ActivityInfo#COLOR_MODE_DEFAULT},
* {@link ActivityInfo#COLOR_MODE_WIDE_COLOR_GAMUT} or {@link ActivityInfo#COLOR_MODE_HDR}.</p>
*
* <p>The requested color mode is not guaranteed to be honored. Please refer to
* {@link #getColorMode()} for more information.</p>
*
* @see #getColorMode()
* @see Display#isWideColorGamut()
* @see Configuration#isScreenWideColorGamut()
*/
public void setColorMode(@ActivityInfo.ColorMode int colorMode) {
final WindowManager.LayoutParams attrs = getAttributes();
attrs.setColorMode(colorMode);
dispatchWindowAttributesChanged(attrs);
}
/**
* Returns the requested color mode of the window, one of
* {@link ActivityInfo#COLOR_MODE_DEFAULT}, {@link ActivityInfo#COLOR_MODE_WIDE_COLOR_GAMUT}
* or {@link ActivityInfo#COLOR_MODE_HDR}. If {@link ActivityInfo#COLOR_MODE_WIDE_COLOR_GAMUT}
* was requested it is possible the window will not be put in wide color gamut mode depending
* on device and display support for that mode. Use {@link #isWideColorGamut} to determine
* if the window is currently in wide color gamut mode.
*
* @see #setColorMode(int)
* @see Display#isWideColorGamut()
* @see Configuration#isScreenWideColorGamut()
*/
@ActivityInfo.ColorMode
public int getColorMode() {
return getAttributes().getColorMode();
}
/**
* <p>Set the color mode of the window. Setting the color mode might
* override the window's pixel {@link WindowManager.LayoutParams#format format}.</p>
*
* <p>The color mode must be one of {@link ActivityInfo#COLOR_MODE_DEFAULT},
* {@link ActivityInfo#COLOR_MODE_WIDE_COLOR_GAMUT} or
* {@link ActivityInfo#COLOR_MODE_HDR}.</p>
*
* @see #getColorMode()
*/
public void setColorMode(@ActivityInfo.ColorMode int colorMode) {
mColorMode = colorMode;
}
/**
* Returns the color mode of the window, one of {@link ActivityInfo#COLOR_MODE_DEFAULT},
* {@link ActivityInfo#COLOR_MODE_WIDE_COLOR_GAMUT} or {@link ActivityInfo#COLOR_MODE_HDR}.
*
* @see #setColorMode(int)
*/
@ActivityInfo.ColorMode
public int getColorMode() {
return mColorMode;
}