本帖最后由 archer_xy 于 2012-04-28 16:19:18 编辑

解决方案 »

  1.   

    view 上面叠加 glSurfaceView
    或者
    surfaceView 上面叠加 glSurfaceView懂的帮帮忙。
      

  2.   

    直接把这个glSurefaceView添加到viewgroup中拜,不过要设置一下surfaceview的属性, 透明, 而且要setZOrderTop(true), 位于最上层....
      

  3.   

    view和glSurefaceView都可以看成控件,然后在xml中用framelayout布局,这样可以不?
      

  4.   

    关键代码如下,screen是我的view类: if (screen == null)
    screen = new Screen(this);
    setContentView(R.layout.test_framelayout);
    frmLayout = (FrameLayout)findViewById(R.id.abc1);
    frmLayout.addView(screen);//一幅图

    frmLayout2= (FrameLayout)findViewById(R.id.abc2);
    frmLayout2.addView(_glSurfaceView);//一个正方形
    这三行代码是为了正方形背景透明:
    _glSurfaceView.setEGLConfigChooser(8,8,8,8, 16, 0);
    _glSurfaceView.getHolder().setFormat(PixelFormat.TRANSLUCENT);
    scene.backgroundColor().setAll(0x00000000);
    xml代码如下<?xml version="1.0" encoding="utf-8"?> 
    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
        android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > 
            
    <FrameLayout android:id="@+id/abc1"
    android:layout_height="wrap_content"
    android:layout_width="wrap_content"
    />
     
    <FrameLayout android:id="@+id/abc2"
    android:layout_height="wrap_content"
    android:layout_width="wrap_content"
    /></FrameLayout> 
    通过测试,单独addView(screen),正常,显示了一幅图。
    单独addView(_glSurfaceView),也正常,一个正方形。但是,像代码中那样都加入,则只显示正方形,背景纯黑色。
      

  5.   

    为何同时addView(screen)和addView(_glSurfaceView)时,只能显示正方形呢?
      

  6.   

    搞定了,还要一句话:_glSurfaceView.setZOrderOnTop(true);
    感谢楼上几位,都有帮助,我把工程上传到了
    http://download.csdn.net/detail/archer_xy/4276249
    有兴趣的可以看看。