I'm playing a video in Andengine on

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

Setting setZIndex also didn't work

Here's a screenshot:


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

  • 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

It should be straightforward, I think:

  • Set Z index of your WorldIcon higher than VideoView.
  • Do scene.sortChildren() to apply the Z index sorting.
  • \$\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\$ Dec 19 '13 at 6:27

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

  • \$\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\$ 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.