ButterKnife不多说,直接说配置和使用吧。
1:首先要添加项目依赖:file->Settrings->Plugins->搜索ButterKnife->ok
2:Project的build.gradle文件中增加classpath:
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
3:在app的build.gradle文件中增加:
apply plugin: 'android-apt' android { ... } dependencies { compile 'com.jakewharton:butterknife:8.4.0' apt 'com.jakewharton:butterknife-compiler:8.4.0' }
4:使用方法:
5:
勾选点击事件->Confirm 即可
Github:https://github.com/JakeWharton/butterknife;