简体   繁体   English

如何在 Android 中隐藏状态栏

[英]How to hide status bar in Android

I referred this link .我提到了这个链接 In that if the user clicks on EditText(for ex To: ) at that time keyboard will be popped out and at the same time the user can be able to scroll to see all remaining views(ex: compose,subject, send button) in that screen.如果用户点击 EditText(例如 To: ),那么键盘将被弹出,同时用户可以滚动查看所有剩余的视图(例如:撰写、主题、发送按钮)那个画面。 Similarly in my app I have one activity in that I am having some widgets or views.同样,在我的应用程序中,我有一项活动,即我有一些小部件或视图。 Suppose if the user clicks on Edittext which is in my Activity then keyboard is popping out and i can be able to scroll to see remaining views.假设如果用户单击我的 Activity 中的 Edittext,那么键盘会弹出,我可以滚动查看剩余的视图。 But if i give this attribute android:theme="@android:style/Theme.NoTitleBar.Fullscreen" in manifest i was unable to scroll to see remaining views but if give attribute android:theme="@android:style/Theme.NoTitleBar" like this in manifest I can be able to scroll to see remaining view but there is status bar in that screen, here I want full screen and even if the keyboard is popped out I can scroll to see remaining views..?但是如果我在清单中给出这个属性android:theme="@android:style/Theme.NoTitleBar.Fullscreen"我无法滚动查看剩余的视图但是如果给出属性android:theme="@android:style/Theme.NoTitleBar"像这样在清单中我可以滚动查看剩余视图,但该屏幕中有状态栏,这里我想要全屏,即使弹出键盘我也可以滚动查看剩余视图..? what changes I have to made for this..?我必须为此做出哪些改变..?

Write this in your Activity在你的活动中写下这个

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    requestWindowFeature(Window.FEATURE_NO_TITLE);
    this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
}

Check Doc here : https://developer.android.com/training/system-ui/status.html在此处检查文档: https : //developer.android.com/training/system-ui/status.html

and your app will go fullscreen.你的应用程序将全屏显示。 no status bar, no title bar.没有状态栏,没有标题栏。 :) :)

Use theme "Theme.NoTitleBar.Fullscreen" and try setting "android:windowSoftInputMode=adjustResize" for the activity in AndroidManifest.xml.使用主题"Theme.NoTitleBar.Fullscreen"并尝试为AndroidManifest.xml.的活动设置"android:windowSoftInputMode=adjustResize" AndroidManifest.xml. You can find details here .您可以在此处找到详细信息。

 if (Build.VERSION.SDK_INT < 16) {
   getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
 } else {
     View decorView = getWindow().getDecorView();
      int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
      decorView.setSystemUiVisibility(uiOptions);
      ActionBar actionBar = getActionBar();
      actionBar.hide();
 }

使用此代码在您的应用中隐藏状态栏并易于使用

getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);

If you need this in one activity, you have to put in onCreate, before setContentView:如果你在一个活动中需要这个,你必须在 setContentView 之前放入 onCreate:

requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);

setContentView(R.layout.your_screen);

Add this to your Activity class将此添加到您的活动类

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    this.getWindow().setFlags(
                        WindowManager.LayoutParams.FLAG_FULLSCREEN, 
                        WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.activity_main);
    // some your code
}

Use this for your Activity .将此用于您的Activity

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
}

If you are hiding the status bar do this in onCreate(for Activity) and onCreateView/onViewCreated(for Fragment)如果您隐藏状态栏,请在 onCreate(for Activity) 和 onCreateView/onViewCreated(for Fragment) 中执行此操作

getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);

And don't forget to clear the flag when exiting the activity or else you will have the full screen in your whole app after visiting this activity.并且不要忘记在退出活动时清除标志,否则在访问此活动后您将在整个应用程序中全屏显示。 To clear do this in your onDestroy(for Activity) or onDestroyView(for Fragment)要清除在您的 onDestroy(for Activity) 或 onDestroyView(for Fragment) 中执行此操作

getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN)

manifest.xml文件中更改应用程序的主题。

android:theme="@android:style/Theme.Translucent.NoTitleBar"
void hideStatusBar() {
        if (Build.VERSION.SDK_INT < 16) {
           getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                    WindowManager.LayoutParams.FLAG_FULLSCREEN);
        } else {
            View decorView = getWindow().getDecorView();
            int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
            decorView.setSystemUiVisibility(uiOptions);
        }
    }

You can use this method to hide the status bar.您可以使用此方法隐藏状态栏。 And this is important to hide the action bar too.这对于隐藏操作栏也很重要。 In this case, you can getSupportActionBar().hide() if you have extended the activity from support lib like Appcompat or you can simply call getActionBar().hide() after the method mentioned above.在这种情况下,如果您从 Appcompat 等支持库扩展了活动,则可以getSupportActionBar().hide()或者您可以在上述方法之后简单地调用getActionBar().hide() Thanks谢谢

Use this code:使用此代码:

requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
super.onCreate(savedInstanceState);
setContentView(R.layout.youractivityxmlname);

In AndroidManifest.xml -> inside the activity which you want to use, add the following:在 AndroidManifest.xml -> 要使用的活动中,添加以下内容:

android:theme="@style/Theme.AppCompat.Light.NoActionBar"
//this is for hiding action bar

and in MainActivity.java -> inside onCreate() method, add the following :在 MainActivity.java -> onCreate() 方法中,添加以下内容:

this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
//this is for hiding status bar

This code hides status bar.此代码隐藏状态栏。

getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);

to hide action bar write this line:-隐藏操作栏写这一行:-

requestWindowFeature(Window.FEATURE_NO_TITLE);

both lines can be written collectively to hide Action bar and status bar.这两行可以一起写来隐藏操作栏和状态栏。 all these lines must be written before setContentView method call in onCreate method.所有这些行必须在onCreate方法中的setContentView方法调用之前编写。

You can hide by using styles.xml您可以使用styles.xml 隐藏

<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>
<style name="HiddenTitleTheme" parent="AppTheme">
    <item name="windowNoTitle">true</item>
    <item name="windowActionBar">false</item>
</style>

just call this in your manifest like this android:theme="@style/HiddenTitleTheme"只需在您的清单中调用它,就像这样android:theme="@style/HiddenTitleTheme"

As FLAG_FULLSCREEN is deprecated from android R. You can use below code to hide status bar.由于 FLAG_FULLSCREEN 已从 android R 中弃用。您可以使用以下代码隐藏状态栏。

 @Suppress("DEPRECATION")
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {

           window.insetsController?.hide(WindowInsets.Type.statusBars())
    } else {

           window.setFlags(
                    WindowManager.LayoutParams.FLAG_FULLSCREEN,
                    WindowManager.LayoutParams.FLAG_FULLSCREEN
            )
        }

You can hide status bar by setting it's color to transperant using xml .您可以通过使用xml将其颜色设置为透明来隐藏状态栏。 Add statusBarColor item to your activity theme:statusBarColor项目添加到您的活动主题:

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="android:statusBarColor">@android:color/transparent</item>
</style>
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setTheme(R.style.Theme_AppCompat_Light_NoActionBar);
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN
    , WindowManager.LayoutParams.FLAG_FULLSCREEN);

    setContentView(R.layout.activity__splash_screen);
}

this is the best solution for me , just write this line in your theme.xml这对我来说是最好的解决方案,只需在你的 theme.xml 中写下这一行

<style name="MyApp" parent="Theme.AppCompat.Light.NoActionBar">
...
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="android:windowFullscreen">true</item>
...
</style>

This is the official documentation about hiding the Status Bar on Android 4.0 and lower and on Android 4.1 and higher这是关于在 Android 4.0 及更低版本和 Android 4.1 及更高版本上隐藏状态栏的官方文档

Please, take a look at it:请看一下:

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

Hide StatusBar隐藏状态栏

private void hideSystemBars() {
    WindowCompat.setDecorFitsSystemWindows(getWindow(), false);
    WindowInsetsControllerCompat windowInsetsController = ViewCompat.getWindowInsetsController(getWindow().getDecorView());
    if (windowInsetsController == null) {
        return;
    }
    // Configure the behavior of the hidden system bars
    windowInsetsController.setSystemBarsBehavior(WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE);
    // Hide both the status bar and the navigation bar
    windowInsetsController.hide(WindowInsetsCompat.Type.systemBars());
}

show StatusBar显示状态栏

private void showSystemBars() {
    WindowCompat.setDecorFitsSystemWindows(getWindow(), false);
    WindowInsetsControllerCompat windowInsetsController = ViewCompat.getWindowInsetsController(getWindow().getDecorView());
    if (windowInsetsController == null) {
        return;
    }
    // Configure the behavior of the hidden system bars
    windowInsetsController.setSystemBarsBehavior(WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE);
    // Hide both the status bar and the navigation bar
    windowInsetsController.show(WindowInsetsCompat.Type.systemBars());
}

for top camera cut with screen用于带屏幕的顶级相机切割

<item name="android:windowLayoutInDisplayCutoutMode" tools:ignore="NewApi">shortEdges</item>

We cannot prevent the status appearing in full screen mode in (4.4+) kitkat or above devices, so try a hack to block the status bar from expanding.我们无法阻止在 (4.4+) kitkat 或更高版本设备中以全屏模式显示状态,因此请尝试破解以阻止状态栏扩展。

Solution is pretty big, so here's the link of SO:解决方案非常大,所以这里是 SO 的链接:

StackOverflow : Hide status bar in android 4.4+ or kitkat with Fullscreen StackOverflow:在 android 4.4+ 或 kitkat 中隐藏状态栏全屏

This solution work for me :)这个解决方案对我有用:)

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (Build.VERSION.SDK_INT >= 19) {
           getWindow().setFlags(AccessibilityNodeInfoCompat.ACTION_NEXT_HTML_ELEMENT, AccessibilityNodeInfoCompat.ACTION_NEXT_HTML_ELEMENT);
           getWindow().getDecorView().setSystemUiVisibility(3328);
    }else{
           requestWindowFeature(Window.FEATURE_NO_TITLE);
           this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
    }

    DataBindingUtil.setContentView(this, R.layout.activity_hse_video_details);
public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // If the Android version is lower than Jellybean, use this call to hide
    // the status bar.
    if (Build.VERSION.SDK_INT < 16) {
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
    } else {
       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();
    }

    setContentView(R.layout.activity_main);

}
...
}

Manifest

android:theme="@android:style/Theme.Holo.NoActionBar.Fullscreen"

If you refer to the Google Documents you can use this method for android 4.1 and above, call this method before setContentView()如果您参考Google 文档,您可以在 android 4.1 及以上版本中使用此方法,请在 setContentView() 之前调用此方法

public void hideStatusBar() {
    View view = getWindow().getDecorView();
    int uiOption = View.SYSTEM_UI_FLAG_FULLSCREEN;
    view.setSystemUiVisibility(uiOption);
    ActionBar actionBar = getActionBar();
    if (actionBar != null) {
        actionBar.hide();
    }
}

including android api 30, this works for me包括android api 30,这对我有用

if (Build.VERSION.SDK_INT < 16) {
        window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN)
    } else if (Build.VERSION.SDK_INT < 30) {
        window.decorView?.systemUiVisibility = View.SYSTEM_UI_FLAG_FULLSCREEN
        actionBar?.hide()
    } else {
        window.decorView.windowInsetsController?.hide(WindowInsets.Type.statusBars())
    }

在 Style.xml 文件中添加或替换

<item name="android:statusBarColor">@android:color/transparent</item>

We can hide status bar in Android 4.1 (API level 16) and higher by using setSystemUiVisibility()我们可以使用 setSystemUiVisibility() 在 Android 4.1(API 级别 16)及更高版本中隐藏状态栏

window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_FULLSCREEN

As per google document we should never show the action bar if the status bar is hidden, so hide that too if necessary.根据谷歌文档,如果状态栏是隐藏的,我们不应该显示操作栏,所以如果有必要也隐藏它。

actionBar?.hide()

I know I'm very late to answer.我知道我回答得太晚了。 I use the following piece of code in a relative java file for this purpose为此,我在相关的 java 文件中使用了以下代码

Objects.requireNonNull(getSupportActionBar()).hide();

If you are working with higher API then you may have noticed the flags as mentioned by the above answers ie FLAG_FULLSCREEN and SYSTEM_UI_FLAG_FULLSCREEN are deprecated, at least in java.如果您正在使用更高的 API,那么您可能已经注意到上述答案中提到的标志,即FLAG_FULLSCREENSYSTEM_UI_FLAG_FULLSCREEN已被弃用,至少在 java 中。

To cover up the whole screen you can define a custom theme:要覆盖整个屏幕,您可以定义自定义主题:

<resources xmlns:android="http://schemas.android.com/apk/res/android">
    <style name="ActivityTheme" parent="Theme.AppCompat.NoActionBar">
        <item name="android:windowFullscreen">true</item>
    </style>
</resources>

Add the theme in your activity in the manifest like android:theme="@style/ActivityTheme" and you are done.manifest中的活动中添加主题,例如android:theme="@style/ActivityTheme"就完成了。

Note : You can also add pre-defined @android themes directly in your manifest: android:theme="@android:style/Theme.Holo.NoActionBar.Fullscreen" .注意:您还可以直接在清单中添加预定义的@android主题: android:theme="@android:style/Theme.Holo.NoActionBar.Fullscreen" In such cases make sure your activity extends Activity() not AppCompatActivity() .在这种情况下,请确保您的活动扩展Activity()而不是AppCompatActivity()

If you are using Compose then you can import如果您使用Compose,则可以导入

implementation "com.google.accompanist:accompanist-systemuicontroller:0.17.0"

then in your screen just write然后在你的屏幕上写

val systemUiController = rememberSystemUiController()
systemUiController.isStatusBarVisible = false

The clean and scalable approach to show and hide system UI I stick to, which works for different Android Api levels:我坚持使用干净且可扩展的方法来显示和隐藏系统 UI,适用于不同的 Android Api 级别:

object SystemBarsCompat {
    private val api: Api =
        when {
            Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> Api31()
            Build.VERSION.SDK_INT == Build.VERSION_CODES.R -> Api30()
            else -> Api()
        }

    fun hideSystemBars(window: Window, view: View, isImmersiveStickyMode: Boolean = false) =
        api.hideSystemBars(window, view, isImmersiveStickyMode)

    fun showSystemBars(window: Window, view: View) = api.showSystemBars(window, view)

    fun areSystemBarsHidden(view: View): Boolean = api.areSystemBarsHidden(view)

    @Suppress("DEPRECATION")
    private open class Api {
        open fun hideSystemBars(window: Window, view: View, isImmersiveStickyMode: Boolean = false) {
            val flags = View.SYSTEM_UI_FLAG_FULLSCREEN or
                View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or
                View.SYSTEM_UI_FLAG_HIDE_NAVIGATION

            view.systemUiVisibility = if (isImmersiveStickyMode) {
                flags or View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
            } else {
                flags or
                    View.SYSTEM_UI_FLAG_IMMERSIVE or
                    View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
            }
        }

        open fun showSystemBars(window: Window, view: View) {
            view.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
        }

        open fun areSystemBarsHidden(view: View) = view.systemUiVisibility and View.SYSTEM_UI_FLAG_HIDE_NAVIGATION != 0
    }

    @Suppress("DEPRECATION")
    @RequiresApi(Build.VERSION_CODES.R)
    private open class Api30 : Api() {

        open val defaultSystemBarsBehavior = WindowInsetsController.BEHAVIOR_SHOW_BARS_BY_SWIPE

        override fun hideSystemBars(window: Window, view: View, isImmersiveStickyMode: Boolean) {
            window.setDecorFitsSystemWindows(false)
            view.windowInsetsController?.let {
                it.systemBarsBehavior =
                    if (isImmersiveStickyMode) WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
                    else defaultSystemBarsBehavior
                it.hide(WindowInsets.Type.systemBars())
            }
        }

        override fun showSystemBars(window: Window, view: View) {
            window.setDecorFitsSystemWindows(false)
            view.windowInsetsController?.show(WindowInsets.Type.systemBars())
        }

        override fun areSystemBarsHidden(view: View) = !view.rootWindowInsets.isVisible(WindowInsets.Type.navigationBars())
    }

    @RequiresApi(Build.VERSION_CODES.S)
    private class Api31 : Api30() {
        override val defaultSystemBarsBehavior = WindowInsetsController.BEHAVIOR_DEFAULT
    }
}

Here How you can hide the status bar Use this function in your Helper Object Class and call it in your activity Here How you can hide the status bar 在 Helper Object Class 中使用此 function 并在您的活动中调用它

    fun hideStatusBar(window: Window, context: Context){
    if (SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        window
            .decorView
            .systemUiVisibility =
            View.SYSTEM_UI_FLAG_LAYOUT_STABLE or
                    View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
        window.statusBarColor = ContextCompat.getColor(context, R.color.transparent_bg_color)
    } else {
        window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN)
    }
}

Call it in your Activity before set Content View.在设置内容视图之前在您的活动中调用它。

hideStatusBar(window, this)
setContentView(R.layout.activity_detail)

Try below.下面试试。 This worked for me.这对我有用。

In your manifest, add the below theme.在您的清单中,添加以下主题。

<activity
   android:theme="@style/Theme.YourAppName.ActivityFullscreenNoCutout"
   android:name=".MainActivity"
   android:exported="true">
   <intent-filter>
      <action android:name="android.intent.action.MAIN" />
      <category android:name="android.intent.category.LAUNCHER" />
   </intent-filter>
</activity>

Then in your styles XML add the below code.然后在您的 styles XML 中添加以下代码。

<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
    <style name="Theme.YourAppName.ActivityFullscreenNoCutout">
        <item name="android:windowLayoutInDisplayCutoutMode" tools:ignore="NewApi">shortEdges</item>
    </style>
</resources>

After that in your MainActivity add the following codes.之后在您的 MainActivity 中添加以下代码。

public class MainActivity extends AppCompatActivity {

    private int currentApiVersion;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);

        currentApiVersion = Build.VERSION.SDK_INT;
        final int flags =
                View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
                        View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
        if (currentApiVersion >= Build.VERSION_CODES.KITKAT) {
            getWindow().getDecorView().setSystemUiVisibility(flags);
            final View decorView = getWindow().getDecorView();
            decorView.setOnSystemUiVisibilityChangeListener(visibility -> {
                if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) {
                    decorView.setSystemUiVisibility(flags);
                }
            });
        }
    }

    @SuppressLint("NewApi")
    @Override
    public void onWindowFocusChanged(boolean hasFocus) {
        super.onWindowFocusChanged(hasFocus);
        if (currentApiVersion >= Build.VERSION_CODES.KITKAT && hasFocus) {
            getWindow().getDecorView().setSystemUiVisibility(
                    View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
                            View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
        }
    }

}

Under res -> values ->styles.xml在 res -> values ->styles.xml 下

Inside the style body tag paste里面的样式正文标签粘贴

<item name="android:windowTranslucentStatus" tools:targetApi="kitkat">true</item>
requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);

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

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