这是一个简单的问题,但我无法弄清楚:
这是我的 xml:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android = "http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<GG.My_pic.testA
android:id = "@+id/myview"
android:layout_width = "fill_parent"
android:layout_height = "fill_parent"
/>
</FrameLayout>
在月球着陆器中,主线程使用
// tell system to use the layout defined in our XML file
setContentView(R.layout.lunar_layout);
但我不能用我的
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
如果我将 R.layout.main 更改为 --> new testA(this) ,它可以工作
(testA是扩展SurfaceView实现SurfaceHolder.Callback的类)
为什么??