如何使GLSurfaceView透明 [英] How to make the GLSurfaceView transparent

查看:159
本文介绍了如何使GLSurfaceView透明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我借鉴使用opengles GLSurfaceView的对象。但GLSurfaceView不是透明的。而不是透明的全黑背景。

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

请帮我如何使GLSurfaceView透明。

Please help me how to make the GLSurfaceView transparent.

我用这个code

setEGLConfigChooser(8, 8, 8, 8, 16, 0);
getHolder().setFormat(PixelFormat.TRANSLUCENT);

先谢谢了。

推荐答案

我做些什么来解决这个问题是我有定期视图,如XML和我打电话内LinearLayouts
linearLayout.addView(glSurface);
linearLayout2.addView(glSurface2);

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);

之后,我打电话给他们按我想的顺序:
linearLayout2.bringToFront();
linearLayout.bringToFront();

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

让我知道如果你要我张贴code。

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

这篇关于如何使GLSurfaceView透明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆