RecyclerView用法
1、添加依赖
在AS的build.gradle中添加依赖,然后同步一下就可以引入依赖包:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support:recyclerview-v7:25.1.0'
testCompile 'junit:junit:4.12'
}
2、在xml布局文件中创建一个RecyclerView的布局
<?xml version="1.0" encoding="utf-8"?>