android – How to change card_view:cardCornerRadius programmatically-ThrowExceptions

Exception or error:

In my project, I am using RecyclerView in my listing using CardView. In my listing I have to set the corner radius of CardView dynamically based on device.

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

Thanks.

How to solve:

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.

Leave a Reply

Your email address will not be published. Required fields are marked *