1
\$\begingroup\$

I'm playing a video in Andengine on

@Override
protected void onSetContentView() {}

However, when I place a sprite on the screen at some point in time, it is placed behind that video view. I want it to appear in front of it.

My attempt:

Entity foregroundLayer= new Entity();
foregroundLayer.attachChild(drag1);
scene.attachChild(foregroundLayer);

Setting setZIndex also didn't work

Here's a screenshot:

screenshot

The world icon is half outside and half behind. It should be on top.

\$\endgroup\$
  • 2
    \$\begingroup\$ NB: you may want to switch to libGDX. It's comparable, and AndEngine is not really maintained any more. \$\endgroup\$ – ashes999 Dec 14 '14 at 3:12
0
\$\begingroup\$

It should be straightforward, I think:

  • Set Z index of your WorldIcon higher than VideoView.
  • Do scene.sortChildren() to apply the Z index sorting.
\$\endgroup\$
  • \$\begingroup\$ videoView is attached to layout and world icon is sprite attached to sceen \$\endgroup\$ – KOTIOS Dec 19 '13 at 3:51
  • \$\begingroup\$ OK . so your using layoutgameActivity? try to set contentView of video layout before attaching the sprite to scene \$\endgroup\$ – asma.farhat Dec 19 '13 at 6:27
-1
\$\begingroup\$

try this. In short terms you have to rearrange the rendering order.

\$\endgroup\$
  • \$\begingroup\$ This is a link only answer. Links will degrade and become corrupt. It's always best to include relevant parts of the link in the answer. \$\endgroup\$ – John Hamilton Dec 18 '17 at 8:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.