2
\$\begingroup\$

I am using Andengine and when I start the examples there are black borders on left and right of the screen. Like this:

10000001
10000001
10000001

where 1 is black and 0 is not black. On my phone (Google Nexus 4) it is always. In emulator sometimes. it is in all examples from here: https://github.com/nicolasgramlich/AndEngineExamples

What is causing this?

| improve this question | | | | |
\$\endgroup\$
2
\$\begingroup\$

Most likely this is because of the ResolutionPolicy you defined. For example if you choose the RatioResolutionPolicy AndEngine will try to keep the same width/height ratio, even if the real device resolutions vary. If you have a screen that is wider than the ratio allows, it will show the mentioned black bars.

You can find all the resolution policies in the GitHub Folder

Consider using CroppedResolutionPolicy that stretches the image beyond the borders and instead of black bars, you will get a bit of your screen cropped. The linked class will also give you two methods to find out how much was cropped.

| improve this answer | | | | |
\$\endgroup\$

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.