Error inflating CardView in API 10

AlessandroAstoneAlessandroAstone ITMember
edited January 2016 in Xamarin.Android

Hi,
My app crashes when running on the Gingerbread 2.3.3 emulator, when inflating a layout containing a CardView inside my RecyclerView rows.
The layout is this:

<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:cardview="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/news_module" android:layout_marginLeft="10dp" android:layout_marginRight="10dp" android:layout_marginBottom="5dp" android:layout_marginTop="5dp" cardview:cardBackgroundColor="#FFFFFF" cardview:cardPreventCornerOverlap="false" android:clickable="true" android:foreground="?android:attr/selectableItemBackground"> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <ImageView android:src="@drawable/androidreport" android:layout_width="match_parent" android:layout_height="wrap_content" android:adjustViewBounds="true" android:id="@+id/newsImg" /> <LinearLayout android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/newsImg"> <TextView android:id="@+id/title" android:text="Title Title Title Title Title" android:textSize="14dp" android:textStyle="bold" android:textColor="#4D4D4D" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_vertical" android:layout_marginTop="5dp" android:layout_marginLeft="10dp" android:layout_marginRight="10dp" android:ellipsize="end" android:maxLines="2" /> <TextView android:id="@+id/news_info" android:text="Giorno + autore" android:textSize="13dp" android:textColor="#666" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_vertical" android:layout_marginTop="0dp" android:layout_marginLeft="10dp" android:layout_marginRight="10dp" android:layout_marginBottom="10dp" android:ellipsize="end" android:maxLines="2" /> </LinearLayout> </RelativeLayout> </android.support.v7.widget.CardView>

I even tried with cardview:cardPreventCornerOverlap set to true, but the error is still there.

Android.Views.InflateException: Binary XML file line #1: Error inflating class android.support.v7.widget.CardView

Everything is good on Android >4.0.3
Since the support library is meant to support up to android 2.1, API 7, it doesn't make sense that it should crash on API 10.
Any idea?

Posts

  • JimBennettJimBennett GBXamarin Team, Insider, University, Developer Group Leader ✭✭✭✭

    If you comment out the CardView bit and just have the RelativeLayout what happens?

Sign In or Register to comment.