【发布时间】:2015-04-25 18:20:03
【问题描述】:
我正在使用 Palette 类以编程方式从图像中获取最主要的颜色,然后我想将其用于状态栏和工具栏。根据材料设计指南,状态栏颜色应该比工具栏颜色深两个色度。
Bitmap bitmap = ((BitmapDrawable) ((ImageView)mImageView).getDrawable()).getBitmap();
if (bitmap != null) {
palette = Palette.generate(bitmap);
vibrantSwatch = palette.getVibrantSwatch();
darkVibrantSwatch = palette.getDarkVibrantSwatch();
}
对于较深的颜色,我使用的是 darkVibrantSwatch,对于较浅的颜色,我使用的是 VibrantSwatch。但在大多数情况下,这些结果彼此非常不同,因此基本上变得无法使用。有什么解决方法吗? 也许如果它可能只得到一种颜色,比如 darkVibrantSwatch,然后以编程方式生成一种颜色浅两个色调的颜色?
【问题讨论】:
标签: android android-5.0-lollipop material-design palette