5

I have an Android game, which has NativeActivity and some Java code in it. My app displayed in fullscreen, but now I need to show status bar and make my app display correctly.

I know how to show status bar, I tried 2 methods:

  1. Android.xml: using Theme.Holo instead of Theme.Holo.Fullscreen in app:theme for application
  2. in onCreate() set FLAG_FORCE_NOT_FULLSCREEN for app window

Both methods gave the same result. Status bar is displayed, but EGL view is displayed under it. Means EGL view is drawn then status bar is drawn over it, a part of EGL view is clipped and not visible.

Is there a way to make it draw EGL view in visible area only, not under status bar?

I tried to fix it but found that ANativeWindow is predefined(?) and when I create EGL view, it has the same size as ANativeWindow. So I cannot change a size of EGL view (no such API). Maybe we have some way to change a size of ANativeWindow? Or some trick with settings/flags for activity which can make it work nicely?

NoAngel
  • 1,072
  • 2
  • 18
  • 27
  • You could try this approach: http://stackoverflow.com/a/8289870/192373. I have not tried it myself. – Alex Cohn Jun 15 '16 at 05:01
  • Tried it but when running app, it shows open animation, receives events APP_CMD_START->APP_CMD_RESUME->APP_CMD_INPUT_CHANGED->APP_CMD_GAINED_FOCUS then suddenly goes to home screen and shows nothing in log, doing nothing. I used SurfaceView for setContentView. – NoAngel Jun 15 '16 at 05:58
  • 1
    I am afraid you missed something, but replacing the content view is not likely to help you anyway. The easy fix though would be to constrain your GL drawing to the borders you have: simply skip **[statusBarHeight](http://stackoverflow.com/a/20584362/192373)** pixels on the top. – Alex Cohn Jun 15 '16 at 07:49
  • ok, I guess no better solution. Resized my virtual screen to height-statusbar height. Fixed touch y=y-statusbar height. Works. But I hate to do it that way, wanted some setting, which nicely applies it for me. It's a pity it looks like Android bug or unfinished feature. – NoAngel Jun 15 '16 at 10:25
  • you can probably set the top margin for your surface and requestLayout() for the content view parent, but this may require tricky co-ordination with the lifecycle, but the resize is as simple as could be. Let's wait maybe somebody has a cleaner working solution. – Alex Cohn Jun 15 '16 at 11:44

0 Answers0