注解Butterknife的使用

1.在工具projectStrcture---app---dependencies搜索butterknife,添加依赖库。

2.在项目的project build.gredle 文件中的dependencies标签下添加。

classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'

3.modulebuild.gredle 文件中添加

apply plugin: 'android-apt'

modulebuild.gredle 文件中的dependencies标签中添加

compile 'com.jakewharton:butterknife:8.4.0'

apt 'com.jakewharton:butterknife-compiler:8.4.0'

4.插件的安装

zelezny : Butterknife插件的使用

 注解Butterknife的使用

 注解Butterknife的使用

1. 使用:

 注解Butterknife的使用

2. 插件的使用

 注解Butterknife的使用

此图中的哪个控件的onclick如果选中,直接可以创建监听的方法。

注解Butterknife的使用