我想我弄清楚了为什么这没用。当我应该为两个参数“ Context,AttributeSet”的情况提供构造函数时,我只为一个参数“
context”的情况提供了构造函数。我还需要使构造函数具有公共访问权限。这是我的解决方法:
public class GhostSurfaceCameraView extends SurfaceView implements SurfaceHolder.Callback { SurfaceHolder mHolder; Camera mCamera; public GhostSurfaceCameraView(Context context) { super(context); init(); } public GhostSurfaceCameraView(Context context, AttributeSet attrs) { super(context, attrs); init(); } public GhostSurfaceCameraView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); init(); }


