我使用Palette类以编程方式从图像中获取最主要的颜色,然后使用它作为状态栏和工具栏。根据材料设计指南,状态栏颜色应该比工具栏颜色暗两个阴影。如何动态改变颜色的阴影android?
Bitmap bitmap = ((BitmapDrawable) ((ImageView)mImageView).getDrawable()).getBitmap();
if (bitmap != null) {
palette = Palette.generate(bitmap);
vibrantSwatch = palette.getVibrantSwatch();
darkVibrantSwatch = palette.getDarkVibrantSwatch();
}
对于较深的颜色,我使用darkVibrantSwatch和较浅的颜色,我使用的是vibrantSwatch。但在大多数情况下,这些结果彼此非常不同,因此基本上变得无法使用。有没有解决方法? 也许如果它可能只有一种颜色,比如说darkVibrantSwatch,然后以编程方式生成两种颜色的颜色较浅?