File tree Expand file tree Collapse file tree 1 file changed +18
-7
lines changed Expand file tree Collapse file tree 1 file changed +18
-7
lines changed Original file line number Diff line number Diff line change 2
2
3
3
[ English] ( https://github.com/DylanCaiCoding/ViewBindingKtx ) | 中文
4
4
5
- [ ![ Download ] ( https://api.bintray.com/packages/dylancai/maven/viewbinding-ktx/images/download .svg )] ( https://bintray.com/dylancai/maven/viewbinding-ktx/_latestVersion ) [ ![ ] ( https://img.shields.io/badge/License-Apache--2.0-green .svg )] ( https://github.com/DylanCaiCoding/ViewBindingKtx/blob/master/LICENSE )
5
+ [ ![ ] ( https://www.jitpack.io/v/DylanCaiCoding/ViewBindingKTX .svg )] ( https://www.jitpack.io/#DylanCaiCoding/ViewBindingKTX ) [ ![ ] ( https://img.shields.io/badge/License-Apache--2.0-blue .svg )] ( https://github.com/DylanCaiCoding/ViewBindingKtx/blob/master/LICENSE )
6
6
7
7
[ ViewBinding] ( https://developer.android.com/topic/libraries/view-binding ) 相对于 Kotlin synthetics、ButterKnife、findViewById,能减少 id 写错或类型写错导致的异常,官方和 JakeWharton 都推荐使用。但是 ViewBinding 直接使用会有点繁琐,所以本库能** 帮助你在各种使用场景用尽可能少的代码来使用 ViewBinding** 。
8
8
20
20
21
21
## Gradle
22
22
23
+ 在根目录的 build.gradle 添加:
24
+
25
+ ``` groovy
26
+ allprojects {
27
+ repositories {
28
+ ...
29
+ maven { url 'https://www.jitpack.io' }
30
+ }
31
+ }
32
+ ```
33
+
23
34
添加配置和依赖:
24
35
25
36
``` groovy
26
37
android {
27
- viewBinding {
28
- enabled = true
38
+ buildFeatures {
39
+ viewBinding = true
29
40
}
30
41
}
31
42
32
43
dependencies {
33
44
// 以下都是可选,请根据需要进行添加
34
- implementation 'com.dylanc :viewbinding-ktx:1.1.2 '
35
- implementation 'com.dylanc :viewbinding-nonreflection-ktx:1.1.2 '
36
- implementation 'com.dylanc :viewbinding-base-ktx :1.1.2 '
37
- implementation 'com.dylanc :viewbinding-brvah-ktx :1.1.2 '
45
+ implementation 'com.github.DylanCaiCoding.ViewBindingKTX :viewbinding-ktx:1.2.0 '
46
+ implementation 'com.github.DylanCaiCoding.ViewBindingKTX :viewbinding-nonreflection-ktx:1.2.0 '
47
+ implementation 'com.github.DylanCaiCoding.ViewBindingKTX :viewbinding-base:1.2.0 '
48
+ implementation 'com.github.DylanCaiCoding.ViewBindingKTX :viewbinding-brvah:1.2.0 '
38
49
}
39
50
```
40
51
You can’t perform that action at this time.
0 commit comments