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);
    }

解决方案 »

  1.   

    第一个时给自己 在java代码里创建使用的,第二个时在xml 使用该自定义类使用的,第三个你可以不创建,因为这是根据你当前activity的style进行设置的
      

  2.   

    1 楼 正解 这种问题 百度 答案 一大堆 : 1. 在代码中直接new一个Custom View实例的时候,会调用第一个构造函数.这个没有任何争议.
    2. 在xml布局文件中调用Custom View的时候,会调用第二个构造函数.这个也没有争议.
    3. 在xml布局文件中调用Custom View,并且Custom View标签中还有自定义属性时,这里调用的还是第二个构造函数. 参考 : https://blog.csdn.net/liujianxun111/article/details/79053154