Android: 使用 @ViewInject 来替代 findViewById

如果你在android 项目中看到这样的代码: 

// 变量声明中
@ViewInject(R.id.textView_dialog)
private TextView textView_dialog;


// onCreate方法中:
ViewUtils.inject(this);


不用慌, 它就等同于: 

private TextView textView_dialog;
//...
textView_dialog = (TextView)findViewById(R.id.textView_dialog);
posted @ 2021-07-19 11:18  Jiangxuhua  阅读(250)  评论(0)    收藏  举报