Android studio ButterKnife插件

1、功能:给所有的有id的控件添加注解

 

2、github地址

https://github.com/avast/android-butterknife-zelezny

 

3、插件下载地址

http://plugins.jetbrains.com/plugin/7369

 

4、安装

1、File->Settings->plugins->Install plugin from disk 选择下载的jar文件
2、在对应的module build.gradle. 添加 compile 'com.jakewharton:butterknife:7.0.1' 然后执行同步或者clean project 就可以了。亲测可以

 5、补充:

1、在项目build.gradle 中添加
dependencies { 
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
}

2、在App目录添加
apply plugin: 'com.neenbedankt.android-apt'
dependencies { 
compile 'com.jakewharton:butterknife:8.0.1'
apt 'com.jakewharton:butterknife-compiler:8.0.1'// apt 'com.jakewharton:butterknife-compiler:8.0.0'
}

3、在Activity中添加:
ButterKnife.bind(this);

4、目前除了可以注解View,同时也可以注解点击事件等
posted @ 2015-11-18 17:42  lipeil  阅读(1280)  评论(0编辑  收藏  举报