在微博中发现的偷懒方案,好简单。。
//结果与(...)findViewById(R.id....)一模一样,采用$作为方法名称,借鉴自jQuery
public <T extends View> T $(int id) {
return (T)super.findViewById(id);
}private EditText editor;
editor = $(R.id.p_name);
editor.setText("Hello World!");findViewById 的偷懒方案,这函数名,哈哈。除了注解和在线生成,多了种偷懒方式
原文:http://blog.csdn.net/js931178805/article/details/42917957