Android Cardview remove space margin in Pre-lolipop


Cardview post-lolipop will not have space margin bugs. To avoid this UI Bugs, use the xml below:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:card_view="http://schemas.android.com/apk/res-auto"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/menu_background"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:cardMaxElevation="0dp"
    app:cardElevation="0dp"
    card_view:cardPreventCornerOverlap="false"
    card_view:cardCornerRadius="1dp"
    card_view:cardUseCompatPadding="true"
    app:cardBackgroundColor="@color/md_grey_900">

    ……

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.