Android Material Palette透明度错误

Dai*_*run 5 android material-design android-palette

我遇到以下情况时,最近一直在玩Bitmaps和调色板:

java.lang.IllegalArgumentException: background can not be translucent
    at android.support.v7.graphics.ColorUtils.findMinimumAlpha(ColorUtils.java:90)
    at android.support.v7.graphics.ColorUtils.getTextColorForBackground(ColorUtils.java:127)
    at android.support.v7.graphics.Palette$Swatch.ensureTextColorsGenerated(Palette.java:621)
    at android.support.v7.graphics.Palette$Swatch.getTitleTextColor(Palette.java:605)
Run Code Online (Sandbox Code Playgroud)

深入了解源代码,我发现:

private static int findMinimumAlpha(int foreground, int background, double minContrastRatio) {
    if (Color.alpha(background) != 255) {
        throw new IllegalArgumentException("background can not be translucent");
    }
    ...
}
Run Code Online (Sandbox Code Playgroud)

我使用的图像是这样的:

一个简单的操作栏搜索图标 原始图标

我认为这个问题与图像在某种程度上完全透明有关.我目前正在执行与throw子句几乎相同的检查Color.alpha(palette.getSomeColor()) != 255,但这只是错误的.

在处理Palettes时是否有一种解决这个问题的方法?我觉得好像这是一个常见的错误,我必须做错了什么,或者错过了一些关于这个的指南.