I am creating a view in which I have one ImageButton
and one ImageView
, and I want to change its color using image palette. I am getting the color from image but don't know how to set the image color (remember its ImageButton color, not background color).
Here is code that I have tried:
Palette.from(bitmap).generate(new Palette.PaletteAsyncListener() {
@Override
public void onGenerated(Palette palette) {
Palette.Swatch vibrantSwatch2 = palette.getLightVibrantSwatch();
if (vibrantSwatch2 != null) {
favourite.setColorFilter(vibrantSwatch2.getBodyTextColor());
playlist.setColorFilter(vibrantSwatch2.getBodyTextColor());
}
}
});