Waz*_*_Be 8 android palette android-support-library
我目前正在使用支持库中的Palette API(https://developer.android.com/tools/support-library/features.html#v7-palette)
下面的代码适用于数百张图片,完全没问题.我根据调色板结果设置文本和背景颜色.结果很棒,非常漂亮(如果你想在你的应用程序中重复使用它,请不要犹豫!).
不幸的是,在数百张图片中,只有一张不起作用,并给出了奇怪的结果.这就是这个=> http://www.cineswellington.com/images/film/140929075044.jpg
由于调色板没有文档或调试模式,我真的很想知道会发生什么,以及是否有办法了解原始图片中是否存在缺陷或其他什么.
Picasso.with(getActivity()).load("http://www.cineswellington.com/images/film/140929075044.jpg").into(t);
private Target t = new Target() {
@Override
public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
Palette.generateAsync(bitmap, new Palette.PaletteAsyncListener() {
public void onGenerated(Palette palette) {
((ImageView) v.findViewById(R.id.iv)).setImageDrawable(new BitmapDrawable(bitmap));
//At this point, the ImageView is correctly filled, so the bitmap object has no issue.
int textColor = palette.getLightMutedColor(android.R.color.darker_gray);
int bgColor = palette.getDarkMutedColor(android.R.color.white);
Log.d("CVE","textColorInt: "+ textColor);
Log.d("CVE","bgColorInt: "+bgColor);
Log.d("CVE","textColorHexa: "+String.format("#%06X", 0xFFFFFF & textColor));
Log.d("CVE","bgColorHexa: "+String.format("#%06X", 0xFFFFFF & bgColor));
}
});
}
};
Run Code Online (Sandbox Code Playgroud)
这是输出:
textColorInt: 17170432
bgColorInt: 17170443
textColorHexa: #060000
bgColorHexa: #06000B
Run Code Online (Sandbox Code Playgroud)
如果有人可以帮助我重现这个错误,或者告诉我它只发生在我这边,那就太棒了
| 归档时间: |
|
| 查看次数: |
3180 次 |
| 最近记录: |