SurfaceView를 상속하여 만든 클래스를

xml을 이용하여 레이아웃으로 구성할 때,

에러가 나고 프로그램이 종료되는 현상이 일어납니다.

 

예를 들어서,

SurfaceView를 상속하여 MySurfaceVew를 만들었다고 했을 때,

 

xml 을 이용하여 아래와 같이 레이아웃을 구성합니다.

-----------------------------------------------------------------------------------------------------------

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <com.myApp.MySurfaceView

        android:id="@+id/surface"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        />
</LinearLayout>

-----------------------------------------------------------------------------------------------------------

 

이 xml 레이아웃의 아이디를 main 이라고 했을 때,

 

setContentView(R.layout.main);

 

위의 SetcontentView 함수에서 에러가 납니다...

왜 그런걸까요??