简体   繁体   中英

Navigating to activity after onStop() is called

When onPause is called, the Dialog is shown and it's background it's transparent so application behind is visible. So if I press Home button while Dialog is shown and then navigate back to application it shows Dialog with black background, if I dismiss Dialog application continuous normally. So how do I make background visible after navigating to application. Black background only happens when I press Home button so application is not visible. I'm guessing that something strange happens in onStop method...

This is how I call my Dialog:

pauseMenu = new PauseMenu();
pauseMenu.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
pauseMenu.show();

And onCreate from Dialog class:

@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.pause_menu);

    }

Your dialog is recreated automatically, so

pauseMenu.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));

is not called. So, try to call this set in your onCreate() after calling super.onCreate()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM