最新版Android Studio引入RecyclerView的方法,以此記錄
我注意到build.gradle文件內容如下:
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' }
據說AndroidX發布后有些支持發生了一些變化(我也不是很懂)。將第一行復制后appcompat改成recyclerview即可。
2020-10-26
我的版本比你還高,直接寫也報錯,用個注釋就好了