public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
_panel = (Panel) findViewById(R.id.panel);
_panel.setOnTouchListener(this);
}
main.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"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/Xiaohua_Demo"
/>
<com.android.demo.Panel
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/panel"
/>
</LinearLayout>
当我启动应用程序时,在Oncreat()中我无法从R.id.Panel获取_panel,是否有任何遗漏?