1、导入XUtils的lib库
ViewUtils使用方法
- 完全注解方式就可以进行UI绑定和事件绑定。
- 无需findViewById和setClickListener等。
//<strong> xUtils的view注解要求必须提供id,以使代码混淆不受影响</strong>。
<strong>@ViewInject(R.id.textView)
TextView textView;</strong>
//@ViewInject(vale=R.id.textView, parentId=R.id.parentView)
//TextView textView;
@ResInject(id = R.string.label, type = ResType.String)
private String label;
// 取消了之前使用方法名绑定事件的方式,使用id绑定不受混淆影响
// 支持绑定多个id @OnClick({R.id.id1, R.id.id2, R.id.id3})
// or @OnClick(valu