标签:
下面的这个函数参考自一条微博
public <T extends View> T $(int id) { return (T) findViewById(id); }
<T extends View>说明这是一个泛型方法,并且这个泛型是View的子类,返回值是泛型T,函数名借鉴JQuery,使用美元符$
实例调用代码
TextView tv=$(R.id.tv);
标签:
原文地址:http://blog.csdn.net/sbsujjbcy/article/details/42527957