public class EditTextExt extends LinearLayout {
public EditTextExt(Context context) {
this(context, null);
// TODO Auto-generated constructor stub
}
public EditTextExt(Context context, AttributeSet attrs) {
......
......
}
}this(context, null);//<--这是什么意思?this指向谁?
解决方案 »
- 怎么样调用android系统的照相机 ?
- adt20 建立Android工程的时候报错 No Launcher activity found
- textView设置超链接
- android wifi 是如何实现打开wifi后自动连接的
- Android模拟器的IP地址
- android开发中,使用Map API开发的软件生成apk文件时,不能安装,请问怎么解决啊?
- 这个怎么自定义AutoCompleteTextView
- 奇怪:LinearLayout 后续不能追加 View 成员!
- HttpGet请求--返回结果有问题?
- 如何使m_Paint这个图片停留的时间长一点,求大神赐教
- android 2.2 解锁出现异常····
- EditText关联自定义输入法
this(context, null);是引用了构造方法
public EditTextExt(Context context, AttributeSet attrs) {
......
......
}
明白不?
public class Student{
private String name;
private String age;
private String gender;
public Student(String name){
this.name=name;
}
publci Student(String name,String age){
this(name);//调用当前(自己类)的构造函数,相当于Student(name);
this.age=age;
}
publci Student(String name,String age,String gender){
this(name,age);//调用自己类的构造函数,相当于Student(name,age);
this.gender=gender;
}
}
明不?
this(name,age);//调用自己类的构造函数,相当于Student(name,age);
this.gender=gender;
}
也可以写成
publci Student(String name,String age,String gender){
this.name=name;
this.age=age;//上面那么写是为了减少代码的重复性
this.gender=gender;
}