Cardview – white border around card

I know it’s a bit late, but for anyone having a similar problem: I had the same issue: A white border was shown on pre-lollipop devices. I solved it setting the cardPreventCornerOverlap to false on your XML. Like this: <android.support.v7.widget.CardView xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:card_view=”http://schemas.android.com/apk/res-auto” android:layout_width=”wrap_content” android:layout_height=”match_parent” android:layout_marginRight=”6dp” card_view:cardPreventCornerOverlap=”false”> <LinearLayout android:layout_width=”match_parent” android:layout_height=”match_parent” android:orientation=”vertical”> <!– some other views –> … Read more

CardView goes on top of FrameLayout, but declared first

In case someone gets here and the solution for setting elevation doesn’t work for them (like in my case, where I needed to draw an image above the CardView and having a shadow on it was not acceptable), you can solve the issue by wrapping the CardView inside another FrameLayout. In the example provided, it … Read more

Center a CardView in a RecyclerView with only one element

I’ve implemented simple HelloWorld app, which shows list of cities and based on how many museums it has – shows full-sized city-card or the centered, wrapped version of it. (Yes, I’m not exactly good at arts 🙂 ) Here’s how I did it. TL;DR: The crucial part is ItemDecoration: set proper items offset and you’ll … Read more

What is the best practice to group items into CardView?

TL;DR: It’s not one CardView which hosts elements, it’s several successive CardViews with different margins: For the top CardView in group: android:layout_marginTop=”5dp” android:layout_marginLeft=”5dp” android:layout_marginRight=”5dp” android:layout_marginBottom=”0dp” card_view:cardCornerRadius=”0dp” For the bottom CardView in group: android:layout_marginTop=”0dp” android:layout_marginLeft=”5dp” android:layout_marginRight=”5dp” android:layout_marginBottom=”5dp” card_view:cardCornerRadius=”0dp” And the middle one, as set margins Top&Bottom to 0: android:layout_marginTop=”0dp” android:layout_marginLeft=”5dp” android:layout_marginRight=”5dp” android:layout_marginBottom=”0dp” card_view:cardCornerRadius=”0dp” About Inbox app: … Read more