相关疑难解决方法(0)

扩展类和android.support.v7.widget.CardView时出错

我想在我的项目中使用CardView,但是当我运行我的应用程序时,我收到以下错误.我正在使用Eclipse.

Error: Error inflating class and android.support.v7.widget.CardView

The graphical view of my xml file says 'The following classes could not be instantiated:
- android.support.v7.widget.CardView (Open Class, Show Error Log)
See the Error Log (Window > Show View) for more details.'
Run Code Online (Sandbox Code Playgroud)

请帮忙.

这是我使用过的片段的布局 CardView

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.log.MyContactsFragment" >

<!-- TODO: Update blank fragment layout -->

<android.support.v7.widget.CardView
    xmlns:card_view="http://schemas.android.com/apk/res-auto"
    android:id="@+id/cvContactDetails"
    android:layout_width="match_parent"
    android:layout_height="200dp"
    android:layout_gravity="center"
    android:background="?android:attr/selectableItemBackground"
    android:clickable="false"
    android:elevation="20dp" >

    <TextView
        android:id="@+id/tvContacts"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Contact Info" />

    <Button
        android:id="@+id/bDelete"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" …
Run Code Online (Sandbox Code Playgroud)

eclipse android android-cardview android-5.0-lollipop android-recyclerview

25
推荐指数
3
解决办法
6万
查看次数