Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8355973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T10:02:04+00:00 2026-06-09T10:02:04+00:00

I have a layout which includes a GLSurfaceView which takes up the whole screen.

  • 0

I have a layout which includes a GLSurfaceView which takes up the whole screen. At the bottom of the screen, I have a semi-transparent toolbar (LinearLayout) which overlays the GLSurfaceView.
Also, my app is full screen (android:theme="@android:style/Theme.NoTitleBar.Fullscreen).

Usually, everything is fine, but starting with ICS, whenever the user comes back to the app (returning from onPause), the OS plays a quick animation where the app starts with the Android status bar showing at the top and the app screen pushed down. Then the status bar disappears and the app’s screen moves up by that much to get to its normal full screen position.

When this animation completes, the GLSurfaceView ends up overlaying the top half of the toolbar, with the toolbar overlaying the bottom half of the GLSurfaceView. It looks like the part of the toolbar showing at the bottom is exactly the size of the Android status bar.

Of course, I would like the toolbar to completely show and overlay the GLSurfaceView, which is what happens when the app is started all the way from onCreate.

Anybody has an idea about what causes this problem and how to fix it?

I found one workaround, but it is far from optimal.
I can get the toolbar to show correctly by posting invalidate() to the toolbar some time after onResume() is called. But if the invalidate() is called too quickly, the problem does not get fixed.
Here is the code for the workaround where invalidate() is called 5 seconds after onResume(), causing the toolbar to show correctly 5 seconds after the app restarts.

@Override
protected void onResume() {
    super.onResume();    

    mGLSurfaceView.onResume();

    // Test to try to fix half hidden toolbar problem
    View toolBar = findViewById(R.id.menu_bar);
    toolBar.postDelayed(new Runnable() {
        @Override
        public void run() {
            View toolBar = findViewById(R.id.menu_bar);
            toolBar.invalidate();
        }
    }, 5000);
}

Edit:
The above code does not cause the toolbar to show correctly. I took out a line setting text in a debug TextView in the code above, and it turns out that the toolbar does not show up if I don’t update that totally unrelated TextView!

I found another way to make the poor workaround above work by first removing the toolbar when onResume is called and bringing it back a while later. See the code below:
Please note that using View.INVISIBLE instead of View.GONE will not make the toolbar appear after the delay.

@Override
protected void onResume() {
    super.onResume();    

    mGLSurfaceView.onResume();

    // Test to try to fix half hidden toolbar problem
    View toolBar = findViewById(R.id.menu_bar);
    toolBar.setVisibility(View.GONE);
    toolBar.postDelayed(new Runnable() {
        @Override
        public void run() {
            View toolBar = findViewById(R.id.menu_bar);
            toolBar.setVisibility(View.VISIBLE);
            //mDebugText.setText("Menu bar to front.\n" + mDebugText.getText());
        }
    }, 5000);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T10:02:07+00:00Added an answer on June 9, 2026 at 10:02 am

    I found more details about this problem and a better workaround, so here is the new info.

    First, I discovered that the problem only happened when I was showing ads using Samsung’s AdHubView class, which is derived from RelativeLayout, so the problem might or might not be related to RelativeLayout.

    This ad view is included in the same top FrameLayout which also includes the GLSurfaceView and the toolbar (LinearLayout). This top FrameLayout is not explicitely declared since I used <merge > as the top element of my layout.

    Now about the better workaround, what I did is hide the AdHubView in onPause and show it again in onWindowFocusChanged. I also tried showing it again in onResume but that didn’t work in the case where the screen was turned off and I had to unlock the screen to return to the app.

    Here are some code samples:

    protected void onPause() {
        super.onPause();
    
        mAdView.setVisibility(AdHubView.GONE);
    }
    
    public void onWindowFocusChanged(boolean hasFocus) {
        super.onWindowFocusChanged(hasFocus);
    
        if (hasFocus) {
            mAdView.setVisibility(AdHubView.VISIBLE);
        }
    }
    

    With this workaround, I don’t need to wait before forcing the toolbar to the top anymore, as I was doing in my previous workaround, so the user never notices anything weird.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a layout which looks like this: <LinearLayout> <ImageView> android:width=wrap_content android:height:wrap_content ... </ImageView>
I have a CustomButton class (extends LinearLayout ) where I inflate a layout which
Good day, I have a requirement which i need to include a layout (actually
I have a layout which I am inflating in order to dynamically add TableRows
I have a layout setup which can be view here: http://jsfiddle.net/Pn3ts/ It all works
I have an xml layout which I use for each row in my listview:
Help needed.. I have a organization layout which have rectangular shapes not in an
I have a quite complicated HTML/CSS layout which I would like to convert to
I have a layout like this in which I want to display a label
I have layout.jade: html include includes/head body header h1 Jumplink design p web design+creative

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.