Android视图注入库:butterknife

jopen 11年前

Android视图注入库,它使用注释来处理findViewById,Onclick()等内容。示例

class ExampleActivity extends Activity {    @InjectView(R.id.user) EditText username;    @InjectView(R.id.pass) EditText password;      @OnClick(R.id.submit) void submit() {      // TODO call server...    }      @Override public void onCreate(Bundle savedInstanceState) {      super.onCreate(savedInstanceState);      setContentView(R.layout.simple_activity);      ButterKnife.inject(this);      // TODO Use "injected" views...    }  }

项目主页:http://www.open-open.com/lib/view/home/1392018223926