OpenGL を実装するプログラムがあり、glSurfaceView はルート レイアウト (相対レイアウト) にあります。public void onCreate(Bundle savedInstanceState) 関数を呼び出すと、OpenGL からのみ図面を取得し、他のレイアウトは取得しません。なぜこうなった?これは私のコードです:
パッケージ com.reea.red;
import android.app.Activity;
import android.opengl.GLSurfaceView;
import android.os.Bundle;
import android.view.View;
public class AvatarCreator extends Activity {
/** Called when the activity is first created. */
private static int tab=3;
private GLSurfaceView glSurfaceView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
glSurfaceView = new GLSurfaceView(this);
// set our renderer to be the main renderer with
// the current activity context
glSurfaceView.setRenderer(new GlRenderer(this));
setContentView(R.layout.main);
setContentView(glSurfaceView);
// findViewById(R.id.linearLayout1).setVisibility(View.VISIBLE);
//setContentView(R.layout.main);
}
public static int getTab() {
return tab;
}
public static void setTab(int tab) {
AvatarCreator.tab = tab;
}
}