【发布时间】:2011-12-15 21:36:22
【问题描述】:
我想使用 android xml 布局。我已将 glSurfaceView 放在框架布局中,以与线性布局结合使用,如下所示...
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<android.opengl.GLSurfaceView android:id="@+id/surfaceviewclass"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</FrameLayout>
<LinearLayout android:id="@+id/gamecontrolslayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="5"
android:background="@drawable/backdrop">
//some layout stuff
</LinearLayout>
<LinearLayout>
然后我这样称呼我的布局
setContentView(R.layout.main);
GLSurfaceView glSurfaceView = (GLSurfaceView)findViewById(R.id.surfaceviewclass);
在 onCreate();
如何调用我的 glSurfaceView 以便我可以使用这样的 xml 布局并引用我自己的 GLSurfaceView 类(下面是引用我自己的 GLSurfaceView 类的代码)...
glSurfaceView = new MyGLSurfaceView(this);
setContentView(glSurfaceView);
有没有将这两者结合起来?我想这样做,因为我的 glSurfaceView 类中有很多东西,比如文件加载和触摸事件。只有我刚刚考虑过实现这个新布局
【问题讨论】:
标签: java android android-layout opengl-es glsurfaceview