我有一个实现 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;
}
}