docs: update hikage-core

This commit is contained in:
2025-12-14 20:48:35 +08:00
parent 3a72d9323b
commit 98b7af6293
2 changed files with 6 additions and 6 deletions

View File

@@ -334,7 +334,7 @@ val textView = hikage.getOrNull<TextView>("my_text_view")
Hikage provides functions corresponding to component class names for Android basic layout components.
You can directly use these functions to create components without using generics to declare them. If you need components provided by Jetpack or Material,
the [hikage-widget-androidx](../library/hikage-widget-androidx.md) or [hikage-widget-material](../library/hikage-widget-material.md) modules can be introduced.
the [hikage-widget-androidx](./hikage-widget-androidx) or [hikage-widget-material](./hikage-widget-material) modules can be introduced.
> The following example
@@ -398,14 +398,14 @@ class MyCustomView(context: Context, attrs: AttributeSet? = null) : View(context
inline fun <reified LP : ViewGroup.LayoutParams> Hikage.Performer<LP>.MyCustomView(
lparams: Hikage.LayoutParams? = null,
id: String? = null,
init: HikageView<MyCustomView> = {},
noinline init: HikageView<MyCustomView> = {},
// If this component is a container, you can declare a `performer` parameter.
// performer: HikagePerformer<LP> = {}
) = View<MyCustomView>(lparams, id, init)
```
It would seem tedious to implement such complex functions manually every time.
If you want to be able to automatically generate component functions, you can introduce and refer to the [hikage-compiler](../library/hikage-compiler.md) module.
If you want to be able to automatically generate component functions, you can introduce and refer to the [hikage-compiler](./hikage-compiler) module.
### Combination and Disassembly Layout

View File

@@ -321,7 +321,7 @@ val textView = hikage.getOrNull<TextView>("my_text_view")
### 自定义布局组件
Hikage 为 Android 基础的布局组件提供了组件类名对应的函数,你可以直接使用这些函数创建组件,而无需再使用泛型声明它们,如果你需要 Jetpack 或者 Material 提供的组件,
可以引入 [hikage-widget-androidx](../library/hikage-widget-androidx.md) 或 [hikage-widget-material](../library/hikage-widget-material.md) 模块。
可以引入 [hikage-widget-androidx](./hikage-widget-androidx) 或 [hikage-widget-material](./hikage-widget-material) 模块。
> 示例如下
@@ -383,13 +383,13 @@ class MyCustomView(context: Context, attrs: AttributeSet? = null) : View(context
inline fun <reified LP : ViewGroup.LayoutParams> Hikage.Performer<LP>.MyCustomView(
lparams: Hikage.LayoutParams? = null,
id: String? = null,
init: HikageView<MyCustomView> = {},
noinline init: HikageView<MyCustomView> = {},
// 如果此组件是容器,可以声明一个 `performer` 参数
// performer: HikagePerformer<LP> = {}
) = View<MyCustomView>(lparams, id, init)
```
每次都手动实现这样复杂的函数看起来会很繁琐,如果你希望能够自动生成组件函数,可以引入并参考 [hikage-compiler](../library/hikage-compiler.md) 模块。
每次都手动实现这样复杂的函数看起来会很繁琐,如果你希望能够自动生成组件函数,可以引入并参考 [hikage-compiler](./hikage-compiler) 模块。
### 组合与拆分布局