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.

Comments

Post a Comment

Popular posts from this blog

AntiPattern: freezing a UI with Broadcast Receiver

How to centralize the support libraries dependencies in gradle

NotificationListenerService and kitkat