How to make the GLSurfaceView transparent

前端 未结 2 1751
庸人自扰
庸人自扰 2021-01-24 21:57

I am drawing the object on GLSurfaceView using opengles. But GLSurfaceView is not the transparent. Instead of transparent its completely black in background.

Please help

相关标签:
2条回答
  • 2021-01-24 22:25

    You should add a another property for it:

    getHolder().setFormat(PixelFormat.TRANSLUCENT);
    
    // this made it work for me - works only from sdk level 6 on, though....
    
    glview.setZOrderOnTop(true);
    
    0 讨论(0)
  • 2021-01-24 22:40

    What i do to get around this is I have regular view such as LinearLayouts within the xml and i call linearLayout.addView(glSurface); linearLayout2.addView(glSurface2);

    After that i call them by the order i would like: linearLayout2.bringToFront(); linearLayout.bringToFront();

    Let me know if you would like me to post code.

    0 讨论(0)
提交回复
热议问题