Error inflating Coverflow

491 Views Asked by At

I've been trying to get this widget working in my Android project: https://code.google.com/p/android-coverflow/source/browse/

It's called Coverflow, and it kind of replaces the old Gallery widget. Implementing it seemed pretty straightforward until I got the error:

 08-16 17:33:08.289: E/AndroidRuntime(15031): Caused by: android.view.InflateException: Binary XML file line #11: Error inflating class pl.polidea.coverflow.CoverFlow

This is the XML file the error is referring to:

 <pl.polidea.coverflow.CoverFlow class="pl.polidea.coverflow.CoverFlow"
    android:id="@+id/coverflow"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="5dip" >
</pl.polidea.coverflow.CoverFlow>

This question has been asked before on StackOverflow but the answer given here: Android coverflow : Error inflating class pl.polidea.coverflow.CoverFlow didn't work for me.

2

There are 2 best solutions below

1
On

You should Use by this way:

 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical"
    android:layout_width="fill_parent" android:layout_height="fill_parent">
    <view class="pl.polidea.coverflow.CoverFlow" xmlns:coverflow="http://schemas.android.com/apk/res/pl.polidea.coverflow"
            coverflow:imageWidth="100dip" coverflow:imageHeight="150dip" android:id="@+id/coverflow" android:layout_width="fill_parent"
            android:layout_height="wrap_content" android:layout_marginTop="5dip">
    </view>

    <pl.polidea.coverflow.CoverFlow xmlns:coverflow="http://schemas.android.com/apk/res/pl.polidea.coverflow"
            coverflow:imageWidth="100dip" coverflow:imageHeight="150dip"   coverflow:withReflection="true"
            coverflow:imageReflectionRatio="0.2" coverflow:reflectionGap="2dip"   android:id="@+id/coverflowReflect"
            android:layout_width="fill_parent" android:layout_height="wrap_content"   android:layout_marginTop="5dip" />

    <TextView android:text="STATUS" android:layout_width="fill_parent"   android:layout_height="wrap_content"
            android:padding="5dip" android:id="@+id/statusText"></TextView>

</LinearLayout>
6
On

Make sure that "pl.polidea.coverflow.CoverFlow" is your class file(package+java class)... Else replace "pl.polidea.coverflow.CoverFlow" in your xml with your actual class file having coverflow!!