【问题标题】:Recyclerview gives Error inflating class android.support.v7.widget.RecyclerViewRecyclerview 给出错误膨胀类 android.support.v7.widget.RecyclerView
【发布时间】:2018-11-29 18:46:41
【问题描述】:

我在我的项目中使用了 recyclerveiw。一切都很好,但突然开始出现此错误。

  --------- beginning of crash
07-02 15:27:49.029 3175-3175/satlaa.desijewellery E/AndroidRuntime: FATAL EXCEPTION: main
Process: satlaa.desijewellery, PID: 3175
java.lang.RuntimeException: Unable to start activity ComponentInfo{satlaa.desijewellery/satlaa.desijewellery.helper_activity.DJPhotos}: android.view.InflateException: Binary XML file line #43: Binary XML file line #43: Error inflating class android.support.v7.widget.RecyclerView

Caused by: android.view.InflateException: Binary XML file line #43: Binary XML file line #43: Error inflating class android.support.v7.widget.RecyclerView
Caused by: android.view.InflateException: Binary XML file line #43: Error 
inflating class android.support.v7.widget.RecyclerView

Build.Gradle

apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion '28.0.0'
defaultConfig {
    applicationId "satlaa.desijewellery"
    minSdkVersion 16
    targetSdkVersion 27
    versionCode 12
    versionName "1.2"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    vectorDrawables.useSupportLibrary = true
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
sourceSets {
    main {
        res.srcDirs = ['src/main/res/layout/adapter', 'src/main/res/layout', 'src/main/res']
    }
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:customtabs:27.1.1'
implementation 'com.android.support:support-vector-drawable:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.google.android.gms:play-services-ads:15.0.1'
implementation 'com.google.gms:google-services:4.0.1'
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'com.android.volley:volley:1.1.0'
}
apply plugin: 'com.google.gms.google-services'

我搜索了整个互联网,但没有得到解决方案。 我尝试重建和同步应用程序。更新了所有 sdk 工具,但没有任何结果。 我删除了所有的java代码,它仍然报错。

<android.support.v7.widget.RecyclerView
    android:id="@+id/recyclerView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:clipToPadding="false"
    android:overScrollMode="never"
    android:scrollbars="vertical"
    app:fastScrollEnabled="true"
    android:splitMotionEvents="false"
    app:layout_behavior="@string/appbar_scrolling_view_behavior" >
</android.support.v7.widget.RecyclerView>

【问题讨论】:

  • 请提供您的 XML 类并且该类包含您的回收站视图
  • 检查recyclerView的单项布局的第43行。
  • 这是recyclerview
  • 删除布局行为后你检查了吗
  • 尝试删除recyclerview依赖并再次检查

标签: android android-recyclerview


【解决方案1】:
app:fastScrollEnabled="true"

XML 中的这一行出现错误。干脆把这个删了。

【讨论】:

    猜你喜欢
    • 2014-10-18
    • 2017-02-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-07-06
    • 2015-01-06
    • 2017-07-29
    相关资源
    最近更新 更多