报错描述:
java.lang.RuntimeException: A TaskDescription's primary color should be opaque
原因分析:
这错误是由于styles.xml文件的主题颜色代码里设置了alpha透明值导致的。
/**
* Creates the TaskDescription to the specified values.
*
* @param label A label and description of the current state of this task.
* @param icon An icon that represents the current state of this task.
* @param colorPrimary A color to override the theme's primary color. This color must be opaque.
*/
public TaskDescription(String label, Bitmap icon, int colorPrimary) {
if ((colorPrimary != 0) && (Color.alpha(colorPrimary) != 255)) {
throw new RuntimeException("A TaskDescription's primary color should be opaque");
}
mLabel = label;
mIcon = icon;
mColorPrimary = colorPrimary;
}
解决方案:
将alpha值去除即可,如果想要设为全透明用 #00000000 即可。