Układ względny OpenGL i Android

Próbowałem już zadać to pytanieKodowanie układu względnego, ale ta pierwsza próba nie była zbyt jasna.

Chciałbym stworzyć układ względnyGLSurfaceView ale układ musi wyglądać tak:

<RelativeLayout
        android:id="@+id/View1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="@raw/gi"
        android:orientation="vertical" >

        <ImageView
                android:id="@+id/imageView1"
                android:layout_width="64px"
                android:layout_height="64px"
                android:layout_alignParentLeft="true"
                android:layout_alignParentTop="true"
                android:src="@drawable/b1" />

        <ImageView
                android:id="@+id/imageView2"
                android:layout_width="64px"
                android:layout_height="64px"
                android:layout_alignParentTop="true"
                android:layout_toRightOf="@+id/imageView1"
                android:src="@drawable/b2" />

        <ImageView
                android:id="@+id/imageView3"
                android:layout_width="64px"
                android:layout_height="64px"
                android:layout_alignParentTop="true"
                android:layout_toRightOf="@+id/imageView2"
                android:src="@drawable/b3" />
</RelativeLayout>

Jeśli jednak koduję to tak, jak mówią w odpowiedziach, obrazy są nadal umieszczane jeden na drugim. (Użyłem funkcji getId do addrules)

Więc myślę o dodaniu całego pliku xml i działam w ten sposób, ale za każdym razem, gdy ładuję xml aplikacja zatrzymuje się. Oto większość kodu:

public class HelloWorld extends Activity {
...
protected void onCreate(Bundle savedInstanceState) {
    ....
    opengl = new GLSurfaceView(getApplication());
    opengl.setEGLConfigChooser(new GLSurfaceView.EGLConfigChooser() {
        public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display) {
              int[] attributes = new int[] { EGL10.EGL_DEPTH_SIZE, 16, EGL10.EGL_NONE};
              EGLConfig[] configs = new EGLConfig[1];
              int[] result = new int[1];
              egl.eglChooseConfig(display, attributes, configs, 1, result);
              return configs[0];
        }
    });

    renderer = new MyRenderer();
    mGLView.setRenderer(renderer);
    setContentView(opengl);
    addContentView(findViewById(R.id.View1), new RelativeLayout.LayoutParams(
              RelativeLayout.LayoutParams.FILL_PARENT,
              RelativeLayout.LayoutParams.FILL_PARENT));

Pamiętaj, że bez ostatniego połączeniaaddContentView aplikacja działa.

questionAnswers(2)

yourAnswerToTheQuestion