androidkotlinmaterial-uimaterial-designandroid-chips

Set Custom Drawable Background of Material Chip Programetically


I want help. I want UI as below and I am using Material Chip for that.

enter image description here

These are material chip of filter type.

But the tricky part is these all chips get added in view dynamically (Based on API response, adding programmatically). So how can I set custom drawable for selected chips and unselected chips programmatically?

Thank you in Advance!


Solution

  • I have tried to find every possible solution and after reading all documents and answers came to the conclusion that It is NOT possible to give gradient background to Material Chip as this functionality is not provided by the material library itself.

    Simply taking a rounded button and then customizing background will be an easy solution for me and fulfill my requirements.