简体   繁体   English

在调用onStop()之后导航到活动

[英]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. 调用onPause ,将显示该Dialog ,并且该Dialog在背景中是透明的,因此可以看到后面的应用程序。 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. 所以,如果我按Home按钮,显示对话框,然后再返回给应用程序它显示Dialog与黑色的背景,如果我解雇对话框应用程序通常持续。 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... 我猜onStop方法中发生了一些奇怪的事情...

This is how I call my Dialog: 这就是我叫对话框的方式:

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

And onCreate from Dialog class: 以及Dialog类的onCreate:

@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() 因此,尝试在调用super.onCreate()之后在onCreate()中调用此集合。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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