Search code examples
androidxmlandroid-recyclerviewcardview

How can I change the cardview border color dynamically?


I would like to change the border color of my cardview based on the content.Is it possible to reach somehow the xml file from the recyclerview adapter and change the color?


Solution

  • xml file from the recyclerview adapter and change the color?

    No. XML is read only. And you do not need to touch it, but use i.f. findViewById(), find your card view, and use its methods to alter the color.