# # hikage-extension-betterandroid

This is a Hikage extension dependency for BetterAndroid
open in new window UI component-related features.

## # Configure Dependency

You can add this module to your project using the following method.

### # Version Catalog (Recommended)

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.

### # Traditional Method

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.

## # Function Introduction

You can view the KDoc click here
open in new window.

### # Adapter Extension

Hikage provides layout extension function for BetterAndroid's Adapter
open in new window, you can use the Hikage layout directly on the original extension method of the adapter.

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<MyEntity>()
    // Create and bind to a custom RecyclerView.Adapter.
    val adapter = recyclerView.bindAdapter<MyEntity> {
        onBindData { listData }
        onBindItemView(
            Hikageable = {
                TextView(id = "text_view") {
                    text = "Hello, World!"
                    textSize = 16f
                }
            }
        ) { hikage, entity, position ->
            hikage.get<TextView>("text_view").text = entity.name
        }
    }