I’m working on a OpenGL game for Android, now and we had this strange issue. Some time ago we searched for ways of removing the title bar because this being a game you want the whole screen to draw magic on it. :) This is actually simple (or not)! You just add
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" to the activity tag and that’s it.
But when pressing the home button, the app goes in the background and after returning to it, the game area is pushed down by the amount of pixels that the title bar is using. The title bar is disappearing after the app comes to foreground but a black empty space stay at the top of the application. First I thought that this is a bug in our code, not handling some surfaceChanged correctly but after some hours of checking things out everything looked fine. I tried searching using title bar and then action bar because I found something about an action bar in Android, and then layout and I found some discussions about layouts. I tried to see if something comes out wrong in the onLayout function but everything came in just fine (0, 0, 800, 480 – I was testing on a Samsung Galaxy S).
After this, I started suspecting that this is an Android bug and I started searching for bugs and finally I found what I was looking for. It seems that I was right and there is a workaround to this problem. Just adding the following line in the onCreate function of the activity solves the issue.
Well that is it! Two days wasted on this…