0

不膨胀,我想用tablayout和viewpager在recyclerview项目,但是当Android框架想夸大我的布局,我得到这个错误:tablayout在recyclerview

android.view.InflateException: Binary XML file line #9: Error inflating class <unknown>

我的布局:

<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:orientation="vertical" 
    android:layout_width="match_parent" 
    android:layout_height="500dp"> 

    <android.support.design.widget.TabLayout 
     android:id="@+id/tablayout" 
     android:layout_width="match_parent" 
     android:layout_height="80dp" 
     android:paddingBottom="4dp" 
     android:paddingTop="4dp" 
     android:textColor="@color/white" 
     app:tabGravity="fill" 
     app:tabMode="fixed"/> 



    <android.support.v4.view.ViewPager 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:id="@+id/pager"/> 


</LinearLayout> 

我使用compile'c​​om.android.support:design:23.4.0',并且我的recyclerview位于片段中,我的活动由AppCompatActivity扩展

我gradle这个

apply plugin: 'com.android.application' 
apply plugin: 'android-apt' 




android { 
    compileSdkVersion 23 
    buildToolsVersion '24.0.0' 
    useLibrary 'org.apache.http.legacy' 

defaultConfig { 
    applicationId "ir.gallery.main" 
    minSdkVersion 14 
    targetSdkVersion 22 
    multiDexEnabled true 
    versionCode 3906 
    versionName "3.9.0.6" 
} 

buildTypes { 
    release { 
     minifyEnabled true 
     proguardFiles 'proguard-android.txt' 
    } 
    debug { 
     minifyEnabled true 
     proguardFiles 'proguard-android.txt' 
    } 
} 


dependencies { 
compile 'com.android.support:design:23.4.0' 
compile 'com.android.support:cardview-v7:23.4.0' 
compile 'com.android.support:percent:23.4.0' 
compile 'com.github.bumptech.glide:glide:3.7.0' 
compile 'com.liulishuo.filedownloader:library:0.3.2' 
compile 'com.squareup:otto:1.3.8' 
compile 'com.jakewharton:butterknife:8.1.0' 
apt 'com.jakewharton:butterknife-compiler:8.1.0' 
compile 'com.squareup.retrofit2:retrofit:2.1.0' 
compile 'com.squareup.retrofit2:adapter-rxjava:2.1.0' 
compile 'com.squareup.retrofit2:converter-gson:2.1.0' 
compile 'io.reactivex:rxandroid:1.2.1' 
compile 'io.reactivex:rxjava:1.1.6' 
compile 'com.android.support:multidex:1.0.0' 
compile project(':utils') 
} 
+0

有你所使用的主题不同或相同 –

+0

我使用相同的主题为 –

+0

你可以张贴的所有活动的所有活动你的app bulid.gradle –

回答

0

添加这种依赖在你bulid.gradle也

compile 'com.android.support:appcompat-v7:23.4.0'