透明活动但后台活动切换到全屏

时间:2016-09-27 05:39:39

标签: android android-activity

我有两项活动:A和B

使用样式: Appcompat.Light.DarkActionBar windowActionBar false,windowNoTitle true

B使用样式: Theme.Translucent windowActionBar false,windowNoTitle false

我使用A来呼叫B,但是当B出现在屏幕上时,活动A似乎变为全屏。

我怎样才能在不影响A?enter image description here

的情况下显示活动B.

1 个答案:

答案 0 :(得分:1)

我认为你必须动态配置。这是你遵循的一小段代码。这段代码并不准确。

if (Build.VERSION.SDK_INT < 16)
{
    // Hide the status bar
    getWindow().setFlag(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    // Hide the action bar
    getSupportActionBar().hide();
}
else
{
    // Hide the status bar
    getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN);
    / Hide the action bar
    getActionBar().hide();
}

或者您可以参考Here