2015-01-23 3 views
0

CardView을 부 풀릴 때 오류가 발생합니다.Android에서 CardView 클래스를 부 풀릴 때 오류가 발생했습니다.

내부 어댑터의 의 getView() :

... 
    LinearLayout layoutView = (LinearLayout) 
inflater.inflate(R.layout.actor_layout, parent, false); 
... 

actor_layout.xml :

01-24 02:16:37.660: E/AndroidRuntime(2776): android.view.InflateException: Binary XML file line #10: Error inflating class android.support.v7.widget.CardView 
01-24 02:16:37.660: E/AndroidRuntime(2776):  at android.view.LayoutInflater.createView(LayoutInflater.java:633) 
01-24 02:16:37.660: E/AndroidRuntime(2776):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743) 
01-24 02:16:37.660: E/AndroidRuntime(2776):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:806) 
01-24 02:16:37.660: E/AndroidRuntime(2776):  at android.view.LayoutInflater.inflate(LayoutInflater.java:504) 
01-24 02:16:37.660: E/AndroidRuntime(2776):  at android.view.LayoutInflater.inflate(LayoutInflater.java:414) 
01-24 02:16:37.660: E/AndroidRuntime(2776):  at com.example.demojsonparsingimage1.ActorAdapter.getView(ActorAdapter.java:45) 
012 :이 오류가 발생하고

<LinearLayout 
android:id="@+id/linLayoutActor" 
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="wrap_content" > 

<android.support.v7.widget.CardView 
    xmlns:card_view="http://schemas.android.com/apk/res-auto" 
    android:id="@+id/card_view" 
    android:layout_width="200dp" 
    android:layout_height="200dp" 
    android:layout_gravity="center" > 

    <LinearLayout 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:orientation="vertical" > 
      <ImageView 
       android:id="@+id/ImageViewActor" 
       android:layout_width="130dp" 
       android:layout_height="130dp" 
       android:padding="15dp" /> 

       <TextView 
        android:id="@+id/textViewActorName" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:padding="15dp" 
        android:textColor="@android:color/holo_blue_light" 
        android:textSize="20sp" 
        android:textStyle="bold" /> 

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

+0

gradle 종속성을 추가 했습니까? appcompat과 별도로 패키지되어 있습니다. com.android.support : cardview-v7 : 21.0.3' – darnmason

+0

Eclipse를 사용하고 있습니다. 어떻게 gradle 종속성을 추가 할 수 있습니까? – Malwinder

+0

아, 죄송합니다. 요즘 대부분의 사람들이 Android Studio를 사용하고 있다고 가정하는 것이 안전하다고 생각 했으므로 적극 추천합니다. – darnmason

답변

0

Eclipse Android 프로젝트에 CardView를 추가하려면 라이브러리 프로젝트로 추가해야합니다./extras/android/support/v7/cardview에 있어야 Eclipse에서 가져올 수 있습니다.

+0

가져 왔습니다. 이미. – Malwinder

+0

좋아, 프로젝트에서 속성 -> Android로 이동하여 라이브러리로 추가하십시오. –

관련 문제