状态栏是隐藏的,但色调仍然可见

我有一个Android应用程序,它具有播放video的活动。 虽然通常我的应用程序中的某些活动具有动态状态栏颜色,但是当video活动处于横向状态时,我隐藏了状态栏。 但即使我全屏隐藏状态栏,状态栏的色调仍然存在。 请告诉我如何隐藏状态栏的色调。

用于设置状态栏颜色的代码

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { SystemBarTintManager tintManager = new SystemBarTintManager(((Activity) context)); tintManager.setStatusBarTintEnabled(true); tintManager.setNavigationBarTintEnabled(false); tintManager.setTintColor(Color.parseColor("#" + dynamicColor)); float f = Float.parseFloat(".7"); tintManager.setTintAlpha(f); } 

我用于删除状态栏颜色的代码

 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { SystemBarTintManager tintManager = new SystemBarTintManager(this); tintManager.setStatusBarTintEnabled(false); tintManager.setNavigationBarTintEnabled(false); float f = Float.parseFloat("0"); tintManager.setTintAlpha(f); getWindow().setStatusBarColor(Color.TRANSPARENT); } 

现在在tint消除代码中,我将setStatusBarEnabled标志setStatusBarEnabledfalse 。 即使setStatusBarColorTRANSPARENT 。 任何帮助将不胜感激。

正如你所看到的,状态栏是隐藏的,但色调是可见的

尝试在onCreate()中添加此代码

科特林:

 window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS) 

Java:(不确定)

 getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS) 

尝试这个:

 View decorView = getWindow().getDecorView(); int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN; decorView.setSystemUiVisibility(uiOptions); ActionBar actionBar = getActionBar(); actionBar.hide(); 

一旦移动到不同的视图或活动,这些标志将被重置。

您可能已经尝试过,但以防万一:

 View decorView = getWindow().getDecorView(); // Hide the status bar. int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN; decorView.setSystemUiVisibility(uiOptions); // Remember that you should never show the action bar if the // status bar is hidden, so hide that too if necessary. ActionBar actionBar = getActionBar(); actionBar.hide(); 

来自https://developer.android.com/training/system-ui/status.html