Support for Android Cardview contentPadding not working

I would like to add contentPadding to my support card. This add-on is calculated correctly on 4.4 devices, but on the 4.1.2 device the content panel does not work.

build.gradle:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:21.0.3'
    compile 'com.android.support:cardview-v7:21.0.3'
}

XML layout

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:tools="http://schemas.android.com/tools"
            xmlns:card_view="http://schemas.android.com/apk/res-auto"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            tools:context=".MainActivity">

<android.support.v7.widget.CardView
    android:id="@+id/card"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    card_view:cardCornerRadius="4dp"
    card_view:contentPaddingLeft="32dp"
    card_view:contentPaddingRight="32dp"
    card_view:contentPaddingTop="32dp"
    card_view:contentPaddingBottom="32dp">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/ic_launcher"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="This is a very long text with more blablablablablablablablabla bla bla bla blablablablabla bla blablablablablabla blablablablabla blablablablabla blablabla"/>

    </LinearLayout>

</android.support.v7.widget.CardView>

</RelativeLayout>

The result of the operation of the device 4.1.2 : Android 4.1.2 - Sony Xperia L

ContentPadding is not recognized.

The same application using device 4.4.2 : Android 4.4.2 - Samsung Galaxy S4

ContentPadding is recognized correctly.

I found a workaround for this problem in this thread: How to install the add-on for CardView widget in Android L But I would like to know if someone is facing this problem or can provide a better solution?

EDIT: , , Sony XPERIA L Android 4.1.2. Galaxy Nexus 4.1.2, .

+4
1

setUseCompatPadding(true) XML app:cardUseCompatPadding="true"

+1

All Articles