2

우리는 이미 이와 비슷한 질문을 가지고 있지만 모두 이전 버전과의 호환성 또는 일식에 관련되어 있습니다. 내 에뮬레이터 (SDK 23)에가 잘 작동 된 cardView 클래스를 팽창하면서 발생하지만 내 다른 에뮬레이터를하려 할 때 (SDK 19)이 오류가 무엇입니까 및 오류가이 선에 저를 가리키는 :클래스를 부 풀리면서 오류가 발생했습니다. android.support.v7.widget.CardView

@Override 
public RecyclerView.ViewHolder onCreateViewHolderImpl(ViewGroup viewGroup, final ParallaxRecyclerAdapter<Information> adapter, int i) { 

    LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); 
    return new ViewHolder(inflater.inflate(R.layout.custom_row, viewGroup, false)); // this line 

} 

나는 또한 위에서 언급 한 것처럼 getActvity().inflate.....을 시도했지만 여전히 같은 오류가 존재합니다. 또한 내 gradle을 확인했는데 모든 것이 잘 보입니다.

dependencies { 

compile fileTree(include: ['*.jar'], dir: 'libs') 
testCompile 'junit:junit:4.12' 
compile 'com.android.support:appcompat-v7:23.4.0' 
compile 'com.android.support:design:23.4.0' 
compile 'com.mikhaellopez:circularimageview:2.1.1' 
compile 'com.isseiaoki:simplecropview:1.0.16' 
compile 'com.android.support:recyclerview-v7:23.4.0' 
compile fileTree(dir: 'libs', include: ['*.jar']) 
compile 'com.android.support:cardview-v7:23.4.0' 
compile 'com.android.support:support-v4:23.4.0' 
compile('com.github.afollestad.material-dialogs:core:[email protected]') { 
    transitive = true 
} 

내 오류 :

android.view.InflateException: Binary XML file line #10: Error inflating class android.support.v7.widget.CardView 
at android.view.LayoutInflater.createView(LayoutInflater.java:621) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:697) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:756) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:492) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
at pb.myPackage.FeedFragment$3.onCreateViewHolderImpl(FeedFragment.java:689) 
at com.poliveira.parallaxrecyclerview.ParallaxRecyclerAdapter.onCreateViewHolder(ParallaxRecyclerAdapter.java:132) 
at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:5482) 
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4707) 
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4617) 
at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:1994) 
at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1390) 
at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1353) 
at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:574) 
at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3028) 
at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:2906) 
at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3283) 
at android.view.View.layout(View.java:14817) 
at android.view.ViewGroup.layout(ViewGroup.java:4631) 
at android.support.v4.widget.SwipeRefreshLayout.onLayout(SwipeRefreshLayout.java:596) 
at android.view.View.layout(View.java:14817) 
at android.view.ViewGroup.layout(ViewGroup.java:4631) 
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1055) 
at android.view.View.layout(View.java:14817) 
at android.view.ViewGroup.layout(ViewGroup.java:4631) 
at android.support.v4.view.ViewPager.onLayout(ViewPager.java:1695) 
at android.view.View.layout(View.java:14817) 
at android.view.ViewGroup.layout(ViewGroup.java:4631) 
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671) 
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525) 
at android.widget.LinearLayout.onLayout(LinearLayout.java:1434) 
at android.view.View.layout(View.java:14817) 
at android.view.ViewGroup.layout(ViewGroup.java:4631) 
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1055) 
at android.view.View.layout(View.java:14817) 
at android.view.ViewGroup.layout(ViewGroup.java:4631) 
at android.support.design.widget.CoordinatorLayout.layoutChild(CoordinatorLayout.java:1091) 
at android.support.design.widget.CoordinatorLayout.onLayoutChild(CoordinatorLayout.java:801) 
at android.support.design.widget.CoordinatorLayout.onLayout(CoordinatorLayout.java:815) 
at android.view.View.layout(View.java:14817) 
at android.view.ViewGroup.layout(ViewGroup.java:4631) 
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453) 
at android.widget.FrameLayout.onLayout(FrameLayout.java:388) 
at android.view.View.layout(View.java:14817) 
at android.view.ViewGroup.layout(ViewGroup.java:4631) 
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671) 
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525) 
at android.widget.LinearLayout.onLayout(LinearLayout.java:1434) 
at android.view.View.layout(View.java:14817) 
at android.view.ViewGroup.layout(ViewGroup.java:4631) 
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453) 
at android.widget.FrameLayout.onLayout(FrameLayout.java:388) 
at android.view.View.layout(View.java:14817) 
at android.view.ViewGroup.layout(ViewGroup.java:4631) 
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671) 
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525) 
at android.widget.LinearLayout.onLayout(LinearLayout.java: 

단서가 무슨 잘못 여기 것?

XML : 전경 =

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
xmlns:card_view="http://schemas.android.com/apk/res-auto" 
android:paddingLeft="4dp" 
android:paddingRight="4dp" 
android:paddingBottom="2dp"> 

<android.support.v7.widget.CardView 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:foreground="?android:attr/selectableItemBackground" 
    android:id="@+id/cardview" 
    card_view:cardBackgroundColor="@android:color/white" 
    card_view:cardElevation="2dp" 
    card_view:cardMaxElevation="2dp" 
    card_view:cardUseCompatPadding="true"> 

    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:orientation="vertical"> 



....here i have a bunch of other layout elements 
     </RelativeLayout> 
    </android.support.v7.widget.CardView> 



</LinearLayout> 
+1

로그 캣은 말한다 : "바이너리 XML 파일 라인 # 10 : android.support.v7.widget.CardView 클래스를 확장하는 중 오류가 발생했습니다. XML 파일 줄에 오류가 있음을 의미합니다. 우리가 더 잘 지원할 수 있도록 XML 코드를 게시하십시오. –

+0

@RakshitNawani는 업데이트 된 질문을 확인하십시오. –

+0

Can 10 호선이 뭔지 말해줘. n XML로서의 XML이 전체 코드가 아님 –

답변

1

당신이 안드로이드 제거 도움이 시도 "안드로이드 : ATTR/selectableItemBackground을"

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
xmlns:card_view="http://schemas.android.com/apk/res-auto" 
android:paddingLeft="4dp" 
android:paddingRight="4dp" 
android:paddingBottom="2dp"> 

<android.support.v7.widget.CardView 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:id="@+id/cardview" 
    card_view:cardBackgroundColor="@android:color/white" 
    card_view:cardElevation="2dp" 
    card_view:cardMaxElevation="2dp" 
    card_view:cardUseCompatPadding="true"> 

    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:orientation="vertical"> 



....here i have a bunch of other layout elements 
     </RelativeLayout> 
    </android.support.v7.widget.CardView> 



</LinearLayout>