Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.aizuzi:FastAdapter:0.2.7'
}
dependencies {
implementation("com.github.aizuzi:FastAdapter:0.2.7")
}
<dependency>
<groupId>com.github.aizuzi</groupId>
<artifactId>FastAdapter</artifactId>
<version>0.2.7</version>
</dependency>
libraryDependencies += "com.github.aizuzi" % "FastAdapter" % "0.2.7"
:dependencies [[com.github.aizuzi/FastAdapter "0.2.7"]]
使用FastAdapter,可以更加快速简单的使用RecylerView。 建立一个ViewHolder,然后使用fastAdapter.addItem即可使用,无需创建复杂的RecylerView Adapter和ViewHolder。
1.在项目的build.gradle文件添加
implementation 'com.github.aizuzi:fastadapter:0.4.7'
annotationProcessor 'com.github.aizuzi:fastadapter_processor:0.4.7'
2.创建ViewHolder
@RecyclerItemLayoutId(R.layout.item_text)
public abstract class ItemViewHolder extends FastBaseHolder {
@FastAttribute(bindViewId = R.id.title_tv)
String title;
@FastAttribute(bindViewId = R.id.icon_view)
int icon;
@FastAttribute(bindViewId = R.id.image_view)
String image;
}
3.使用
FastAdapter fastAdapter = new FastAdapter(this);
fastAdapter.addItem(new ItemViewHolder_().setTitle("ViewHolder:" + i);