import{_ as l,r as t,o as i,c as r,b as n,d as e,a,e as o}from"./app-Th5ZUiPV.js";const p={},d=o('
You can add this module to your project using the following method.
Add dependency in your project's SweetDependency
configuration file.
libraries:
com.highcapable.hikage:
hikage-extension-betterandroid:
version: +
Configure dependency in your project's build.gradle.kts
.
implementation(com.highcapable.hikage.hikage.extension.betterandroid)
Add dependency in your project's gradle/libs.versions.toml
.
[versions]
hikage-extension-betterandroid = "<version>"
[libraries]
hikage-extension-betterandroid = { module = "com.highcapable.hikage:hikage-extension-betterandroid", version.ref = "hikage-extension-betterandroid" }
Configure dependency in your project's build.gradle.kts
.
implementation(libs.hikage.extension.betterandroid)
Please change <version>
to the version displayed at the top of this document.
Configure dependency in your project's build.gradle.kts
.
implementation("com.highcapable.hikage:hikage-extension-betterandroid:<version>")
Please change <version>
to the version displayed at the top of this document.
It uses the ViewHolderDelegate
provided by BetterAndroid to create extension methods.
Here is a simple example based on RecyclerView
.
The following example
// Assume this is the dataset you need to bind to.
val listData = ArrayList<CustomBean>()
// Create and bind to a custom RecyclerView.Adapter.
val adapter = recyclerView.bindAdapter<CustomBean> {
onBindData { listData }
onBindItemView(
Hikageable = {
TextView(id = "text_view") {
text = "Hello, World!"
textSize = 16f
}
}
) { hikage, bean, position ->
hikage.get<TextView>("text_view").text = bean.name
}
}