且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何避免机器人观点充气例外?

更新时间:2023-11-19 11:03:46

您错过了一个构造函数,

you missed a constructor,

public surfaceviewclass (Context context, AttributeSet attrs) {
     super(context, attrs);
}

编辑:

这是当视图被充气时调用构造函数从XML(构造)。你声明的属性由第二个参数提供

This is the constructor that is called when the view is inflated (constructed) from the xml. The attributes you declared are supplied by the second parameter