Faisal Ahsan Faisal Ahsan - 1 year ago 280
Android Question

How to change card_view:cardCornerRadius programmatically

In my project, I am using

in my listing using
. In my listing I have to set the corner radius of
dynamically based on device.

Is there any way to set cardview corner radius value dynamically?


Answer Source

Use CardView.setRadius(float), see here.

The documentation is pretty good for finding xml attrs and their equivalent methods, it really takes a few seconds.