【发布时间】:2017-02-16 07:57:37
【问题描述】:
这是我用来从调色板中检索颜色的代码。我可以获取颜色但无法设置为浮动操作按钮的背景颜色。
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()));
}
【问题讨论】:
-
添加相关标签并改进格式
-
删除不需要的空格
标签: android floating-action-button