最新版Android Studio引入RecyclerView的方法,以此記錄
我注意到build.gradle文件內(nèi)容如下:
dependencies?{ ????implementation?fileTree(dir:?"libs",?include:?["*.jar"]) ????implementation?'androidx.appcompat:appcompat:1.1.0' ????implementation?'androidx.recyclerview:recyclerview:1.1.0' ????implementation?'androidx.constraintlayout:constraintlayout:1.1.3' ????implementation?'com.blankj:utilcode:1.28.0' ????testImplementation?'junit:junit:4.12' ????androidTestImplementation?'androidx.test.ext:junit:1.1.1' ????androidTestImplementation?'androidx.test.espresso:espresso-core:3.2.0' }
據(jù)說AndroidX發(fā)布后有些支持發(fā)生了一些變化(我也不是很懂)。將第一行復(fù)制后appcompat改成recyclerview即可。
2020-10-26
我的版本比你還高,直接寫也報(bào)錯(cuò),用個(gè)注釋就好了