这是个不错的开源项目,butterKnife直译是:切黄油的小刀。用了两天,发现确实很方便。
Bind Android views and callbacks to fields and methods. http://jakewharton.github.io/butterknife/
Field and method binding for Android views which uses annotation processing to generate boilerplate code for you.
- Eliminate
findViewById
calls by using@BindView
on fields. - Group multiple views in a list or array. Operate on all of them at once with actions, setters, or properties.
- Eliminate anonymous inner-classes for listeners by annotating methods with
@OnClick
and others. - Eliminate resource lookups by using resource annotations on fields.