Android-5: Card and images with rounded corners in Android 4

Card and images with rounded corners in Android 4
As you know the CardView in support library has a different behaviour for API=21 and API < 21.

If you would like to have an image (full or partial) inside your cardView with Rounded corners it is by default only in Android 5.

This gist can be useful to achieve the same aspect also in Android V4 (and as always it can be improved)
Here the link.

The trick is to elaborate the image and obtain an image with rounded corners (I am using the snippet published by +Romain Guy)

Pay attention: you have to use
cardView.setPreventCornerOverlap(false); to avoid the internal padding in api<21.


  1. Really impressed! Everything is very open and very clear clarification of issues. It contains truly facts. Your website is very valuable. Thanks for sharing.

  2. I was reading some of your content on this website and I conceive this internet site is really informative ! Keep on putting up.


Post a Comment

Popular posts from this blog

How to centralize the support libraries dependencies in gradle

AntiPattern: freezing a UI with Broadcast Receiver

NotificationListenerService and kitkat