0
这是我用来从调色板中检索颜色的代码。我能够获得颜色,但无法设置为浮动动作按钮的背景颜色。使用我的图像调色板更改浮动动作按钮的背景颜色
Palette.Swatch vibrantSwatch = palette.getDarkVibrantSwatch();
Palette.Swatch vibrantSwatch2 = palette.getLightVibrantSwatch();
if (vibrantSwatch != null && vibrantSwatch2 != null) {
//fb represents my floating action button
fb.setBackgroundTintList(ColorStateList.valueOf(vibrantSwatch2.getRgb()));
}
添加相关标签,提高格式化 –
删除不需要的空格:您可以使用
对于这一点,你必须导入改变 –