Android注入框架butterknife

开源地址:https://github.com/JakeWharton/butterknifegit

参考:github

1.http://www.jianshu.com/p/4f7338ef806e框架

2.http://blog.csdn.net/itjianghuxiaoxiong/article/details/50177549布局

 

ButterKnife 是在编译时注解,不会在运行时产生负担,Build工程后你会发现它生成了须要的代码,即它不是使用反射或者在运行时生成代码,因此它不会致使任何性能问题,也不会影响应用速度。性能

 

使用心得:ui

1.Activity ButterKnife.bind(this);必须在setContentView();以后,且父类bind绑定后,子类不须要再bindthis

2.Fragment ButterKnife.bind(this, mRootView);.net

3.属性布局不能用private or static 修饰,不然会报错blog

4.setContentView()不能经过注解实现。(其余的有些注解框架能够)it

 

1. 替代findViewById()

2. 设置监听

相关文章
相关标签/搜索