public SurfaceViewTemplate(Context context) {
super(context,null);
} public SurfaceViewTemplate(Context context, AttributeSet attrs) {
super(context, attrs,0);
} public SurfaceViewTemplate(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
super(context,null);
} public SurfaceViewTemplate(Context context, AttributeSet attrs) {
super(context, attrs,0);
} public SurfaceViewTemplate(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
2. 在xml布局文件中调用Custom View的时候,会调用第二个构造函数.这个也没有争议.
3. 在xml布局文件中调用Custom View,并且Custom View标签中还有自定义属性时,这里调用的还是第二个构造函数. 参考 : https://blog.csdn.net/liujianxun111/article/details/79053154