ANDROID ANDENGINE — Set Scene background as trasparent

假装没事ソ 提交于 2019-12-24 15:27:01

问题


­I'm starting to use AndEngine in my app. I've used an xml to define the base style of the app. I've defined a scene in which I'll have some draggable sprites.

I've imported correctly the xml but the scene appears on top of that with a black background that hides the xml graphics. I need to set the scene with transparent background.

How can i do that?


回答1:


Actually you can do that.

It was at least working some time ago with AndEngine running on top of a Camera preview.

It has really been a while since I did this and I didn't keep it up to date, but this class should be of interest for you: http://code.google.com/p/andengineaugmentedrealityextension/source/browse/src/org/anddev/andengine/extension/augmentedreality/BaseAugmentedRealityGameActivity.java




回答2:


The default background of the scene is black. you can't change it.




回答3:


It can change . Use this code.

 @Override
    public Scene onLoadScene() {
            this.mEngine.registerUpdateHandler(new FPSLogger());

            final Scene scene = new Scene();
            scene.setBackground(new ColorBackground(0.09804f, 0.6274f, 0.8784f));


来源:https://stackoverflow.com/questions/7905792/android-andengine-set-scene-background-as-trasparent

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!