1

私はこのようなクラスを持っています:

public class MyOpenGlView extends GLSurfaceView
    {

        public MyOpenGlView(Context context) {
            super(context);
            setRenderer(new MyRenderer()) ;
        }
    }

このクラスを xml レイアウトで次のように宣言します。

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".OpenGlActivity" >

    <test.example.myfirstapp.OpenGlActivity.MyOpenGlView android:id = "@+id/myImage"
        android:layout_width = "wrap_content"
        android:layout_height = "wrap_content"
        />

</LinearLayout>

しかし、「グラフィカルレイアウト」モードで次のエラーが発生します。

The following classes could not be instantiated:
- test.example.myfirstapp.OpenGlActivity.MyOpenGlView (Open Class, Show Error Log)
See the Error Log (Window > Show View) for more details.
Tip: Use View.isInEditMode() in your custom views to skip code when shown in Eclipse

どうしたの?

4

1 に答える 1