How to hide status bar in Android
Asked Answered
S

38

137

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. 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. 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..? what changes I have to made for this..?

Staffman answered 25/3, 2011 at 10:43 Comment(5)
@user448250: Note that you cannot hide the status bar in Android 3.0, and there is a decent chance that you will not be able to hide the status bar going forward. In Android 3.0, the status bar houses the BACK and HOME buttons, so the status bar needs to be always available.Klarrisa
I have just managed to hide both the title and status bar on the emulator with 3.0, API level 11.Summertime
Full screen should be still allowed, user usually doesn't want to see status bar when playing full screen game.Eberhart
@Staffman Did you ever find this out?Commination
What is activity at all? It it some xml file in your website folder?Casady
E
199

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

and your app will go fullscreen. no status bar, no title bar. :)

Edom answered 25/3, 2011 at 18:11 Comment(10)
Note that this will not work if your activity superclass calls setContentView in the onCreate method - the app will quit with an exception.Azarria
@Ron I was testing on API level 8. It's possible the behaviour is different on other levels?Azarria
Is this valid for all versions from 2.3.x to 4.x ?Inhabitant
In this case how to apply scroll view?.. If it applies,is it works? what we can do to work scroll view here.Unmannerly
This still prevents the screen from scrolling when the software keyboard is being shown.Commination
Carefull, Call it after setContentView(). Also, better use addFlags() to save previous flags.Madness
It crashes, even if I place it before or after the setContentView()Seychelles
Use it before super.onCreate(savedInstanceState); if it crashStraiten
Is there any workaround to hide status bar globally ? setting this in every activity sounds stupidFoeticide
It kills me that SO put top answers at the bottom of the page :facepalm:Shopwindow
E
25

Use this code for hiding the status bar in your app and easy to use

getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
Emelyemelyne answered 14/1, 2019 at 13:9 Comment(0)
I
21

Use theme "Theme.NoTitleBar.Fullscreen" and try setting "android:windowSoftInputMode=adjustResize" for the activity in AndroidManifest.xml. You can find details here.

Intercellular answered 25/3, 2011 at 11:14 Comment(1)
With the above approach, my status bar can be hidden when the app is running full screen, however, I can still see the status bar while I swiping down the page. Is there is a way if I don't want the status bar at all?Gond
C
20
 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();
 }
Chuchuah answered 10/5, 2014 at 0:23 Comment(1)
I've noticed that when I use this method, showing the soft-keyboard moves the views above the editText, instead of resizing things. How do I fix this?Huxham
T
15

If you need this in one activity, you have to put in onCreate, before setContentView:

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

setContentView(R.layout.your_screen);
Tabard answered 12/2, 2016 at 9:40 Comment(2)
This way makes keyboard covers input field in webview.Binford
@AllenVork any solution?Tenenbaum
T
12

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
}
Travertine answered 22/6, 2017 at 7:15 Comment(0)
O
10

If you are hiding the status bar do this in onCreate(for Activity) and 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)

getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN)
Obsidian answered 7/2, 2020 at 11:5 Comment(0)
A
9

Use this for your 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);
}
Agiotage answered 4/4, 2016 at 13:40 Comment(0)
K
9

If you are working with higher API then you may have noticed the flags as mentioned by the above answers i.e. FLAG_FULLSCREEN and SYSTEM_UI_FLAG_FULLSCREEN are deprecated.

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.

Note: You can also add pre-defined @android themes directly in your manifest: android:theme="@android:style/Theme.Holo.NoActionBar.Fullscreen". In such cases make sure your activity extends Activity() not AppCompatActivity() although it's not recommended.

Kellogg answered 29/9, 2021 at 19:45 Comment(0)
H
7
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. Thanks

Hospers answered 3/2, 2017 at 1:1 Comment(0)
Q
6

Change the theme of application in the manifest.xml file.

android:theme="@android:style/Theme.Translucent.NoTitleBar"
Quirita answered 12/7, 2014 at 6:31 Comment(1)
Strangely enough this shows an orange bar at the top of the screen. The notification bar is hidden though.Dedie
H
5

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);
Hendrika answered 6/5, 2016 at 6:50 Comment(0)
P
5

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.

Permeability answered 11/11, 2016 at 11:47 Comment(1)
Works beautifully. Thanks!Photogenic
T
5

In AndroidManifest.xml -> inside the activity which you want to use, add the following:

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

and in MainActivity.java -> inside onCreate() method, add the following :

this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
//this is for hiding status bar
Tolidine answered 19/4, 2018 at 10:38 Comment(0)
G
5

You can hide by using 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"

Gambado answered 20/7, 2018 at 6:35 Comment(0)
S
5

this is the best solution for me , just write this line in your 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>
Skullcap answered 26/5, 2021 at 9:8 Comment(0)
G
4

You can hide status bar by setting it's color to transperant using xml. Add statusBarColor item to your activity theme:

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="android:statusBarColor">@android:color/transparent</item>
</style>
Gasman answered 7/1, 2019 at 18:34 Comment(1)
pls add some explanation code only answers are bit confusing to othersFulcrum
H
4

As FLAG_FULLSCREEN is deprecated from android R. You can use below code to hide status bar.

 @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
            )
        }
Hemocyte answered 25/9, 2020 at 22:59 Comment(1)
This is incorrect, they do not behave the same the inset just does like getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN);Berkowitz
H
3

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>
Hardware answered 16/2, 2022 at 10:26 Comment(0)
H
2
@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);
}
Haag answered 10/11, 2019 at 21:48 Comment(3)
While this code may solve the question, including an explanation of how and why this solves the problem would really help to improve the quality of your post, and probably result in more up-votes. Remember that you are answering the question for readers in the future, not just the person asking now. Please edit your answer to add explanations and give an indication of what limitations and assumptions apply.Extrusion
I did not have much idea of what exactly AppCompat is, been just using it. And these three lines did the job.Haag
Pity is that Google's own documentation, as always, is incorrect how to achieve this. Maybe they should copy paste this code.Silures
D
2

including android api 30, this works for me

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())
    }
Denham answered 25/4, 2021 at 2:7 Comment(0)
U
2

The clean and scalable approach to show and hide system UI I stick to, which works for different Android Api levels:

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
    }
}

And for example to hide system bars, it can be called from a Fragment:

SystemBarsCompat.hideSystemBars(requireActivity().window, view)
Underbodice answered 5/2, 2022 at 13:58 Comment(0)
M
1

This is the official documentation about hiding the Status Bar on Android 4.0 and lower and on Android 4.1 and higher

Please, take a look at it:

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

Memling answered 19/1, 2017 at 22:21 Comment(0)
J
0

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.

Solution is pretty big, so here's the link of SO:

StackOverflow : Hide status bar in android 4.4+ or kitkat with Fullscreen

Johathan answered 14/6, 2016 at 10:24 Comment(2)
I think you are wrong, please take a look at the official info about hiding the status bar developer.android.com/training/system-ui/status.htmlMemling
Jose, I will check the information on given link and will update the answer if needed. This question/answer added an year ago when there was not an official solution for this scenario. May be in next release or versions google/android have added the API/method for the same. If they have provided the solution then its a delight. Thanks!Johathan
P
0

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);
Pilsen answered 8/10, 2017 at 5:56 Comment(0)
G
0
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);

}
...
}
Gyre answered 8/11, 2017 at 15:15 Comment(0)
T
0

Used in Manifest

android:theme="@android:style/Theme.Holo.NoActionBar.Fullscreen"
Toreutics answered 10/1, 2018 at 20:8 Comment(1)
Probably depends on theme. In my case an exception occured: "java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity."Acrolith
C
0

If you refer to the Google Documents you can use this method for android 4.1 and above, call this method before 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();
    }
}
Camillecamilo answered 12/7, 2020 at 14:3 Comment(0)
G
0

Add or Replace in Style.xml File

<item name="android:statusBarColor">@android:color/transparent</item>
Grindlay answered 17/6, 2021 at 5:2 Comment(0)
E
0

We can hide status bar in Android 4.1 (API level 16) and higher by using setSystemUiVisibility()

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()
Ednaedny answered 27/6, 2021 at 15:32 Comment(0)
L
0

I know I'm very late to answer. I use the following piece of code in a relative java file for this purpose

Objects.requireNonNull(getSupportActionBar()).hide();
Lowminded answered 29/8, 2021 at 20:4 Comment(0)
B
0

If you are using Compose then you can import

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

then in your screen just write

val systemUiController = rememberSystemUiController()
systemUiController.isStatusBarVisible = false
Botel answered 18/10, 2021 at 3:46 Comment(0)
M
0

Here How you can hide the status bar Use this function in your Helper Object Class and call it in your activity

    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)
Merrymerryandrew answered 15/6, 2022 at 11:12 Comment(0)
P
0

Add the following code to themes.xml file. it will make the notification drawer semi-transparent.

<item name="android:windowTranslucentStatus">true</item>
Powered answered 9/10, 2022 at 18:19 Comment(2)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Gentes
Hello! Consider adding some comments or verbal explanations of what you're doingIncandesce
A
0

100% it's will work for Hide and show statusbar & navigationbar
Call this methods directly for show and hide statusbar * navigationbar

 private void hideSystemUI() {

    View decorView = getWindow().getDecorView();
    int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_FULLSCREEN
            | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
    decorView.setSystemUiVisibility(uiOptions);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);

}

private void showSystemUI() {
    View decorView = getWindow().getDecorView();
    int uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
    decorView.setSystemUiVisibility(uiOptions);
    getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
}

For mor info Rajmeetamil

Anemo answered 23/9, 2023 at 5:31 Comment(0)
C
0

Always put this before setContentView to avoid app crashing.

requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
Compassionate answered 18/3 at 17:45 Comment(0)
I
-1

Under res -> values ->styles.xml

Inside the style body tag paste

<item name="android:windowTranslucentStatus" tools:targetApi="kitkat">true</item>
Incompetent answered 20/3, 2018 at 8:39 Comment(1)
it is throwing error - org.xml.sax.SAXParseException; lineNumber: 6; columnNumber: 79; The prefix "tools" for attribute "tools:targetApi" associated with an element type "item" is not bound.Justification
P
-1
requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
Psychodiagnostics answered 5/2, 2019 at 14:32 Comment(1)
Hello! Consider adding some comments or verbal explanations of what you're doing.Jog

© 2022 - 2024 — McMap. All rights reserved.