Android 框架

Android MVP
 
butterknife
一个专注于Android系统的View注入框架,以前总是要写很多findViewById来找到View对象,有了ButterKnife可以很轻松的省去这些步骤。使用ButterKnife对性能基本没有损失,因为ButterKnife用到的注解并不是在运行时反射的,而是在编译的时候生成新的class
1. build.gradle(project)
buildscript {
  repositories {
    mavenCentral()
    google()
  }
  dependencies {
    classpath 'com.jakewharton:butterknife-gradle-plugin:10.2.3'
  }
}
2. build.gradle(Module)
plugins {
    id 'com.android.application'
    id 'com.jakewharton.butterknife'
}

dependencies {
    
    implementation 'com.jakewharton:butterknife:10.2.3'
    annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.3'
}
3. 绑定
ButterKnife.bind(this);
posted @ 2022-04-29 08:46  dvkc  阅读(116)  评论(0)    收藏  举报