android自定义View的显示,该如何处理

android自定义View的显示
请教一个问题我自定义一个GameView 想在布局文件main.xml中使用,出现了意外停止的状况
如果将布局的setContentView(R.layout.main);改为setContentView(gameView);就没问题了,但是我还需要在一个页面显示其他内容

TestdActivity.java

public class TestdActivity extends Activity {
    GameView gameView=null;
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        gameView=new GameView(this);
        setContentView(R.layout.main);
       // setContentView(gameView);
    }
}


main.xml

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

<chenjiang.android.Test.GameView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
   />
</LinearLayout>


GameView.java

public class GameView extends View {

public GameView(Context context) {
super(context);
}

protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
}
}


我的GameView里面什么都没写,不知道布局文件main.xml中是否有错,能不能这样把GameView当成yield组件来使用
因为我还需要在一个窗口显示其他的组比如button等,该怎么显示




------解决方案--------------------
友情帮顶
------解决方案--------------------
public GameView(Context context) {
super(context);
}
当组件用,这个构造方法中的参数换为两个的。
------解决方案--------------------
应该是构造方法有问题 需要重写
public GameView(Context context,AttributeSet attributeSet)

supe(context,attributeSet);


------解决方案--------------------
重写一下含有两个参数的View构造函数就行了。