使用RecyclerView时出现
Error: inflating class android.support.v7.widget.RecyclerView
解决方法:打开 build.gradle
找到代码如下:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.+'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
如上, 添加依赖:
implementation 'com.android.support:recyclerview-v7:28.0.0' (版本自定)
就OK了!