Posts

Showing posts from November, 2014

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 &lt 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&lt21.

Android-5 tip about the Toolbar and the Style

Toolbar style and theme.
With the new Toolbar you can apply a style and a theme.
They are different!

The style is local to the Toolbar view, for example the background color.

The app:theme is instead global to all ui elements inflated in the Toolbar, for example the color of the title and icons.