How to hide the Status Bar? - android

I am trying to hide the status bar. I have tried the following things.
android:theme="#android:style/Theme.NoTitleBar.Fullscreen" >
In the Manifest.XML I have added the above code.
And in the onCreate() I have added the following:
requestWindowFeature(Window.FEATURE_NO_TITLE);
// hide statusbar of Android
// could also be done later
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
But still I am unable to hide the status bar. Can anyone help?

The approaches you've taken would work on 2.3.X
But if you are talking about 4.0 tablets this is the code
LinearLayout layout = (LinearLayout)findViewById(R.id.layout);
layout.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
If you're talking about a tablet you cannot get rid of the system bar but I suggest you look at this question:
Hide Status bar on Android Ice Cream Sandwich

Just make sure that you are writing above code lines before the line setContentView()?

Related

Hide status bar when using a YoutubeFragment (YoutubePlayer android API)

I have a fullscreen project, and am hiding the statusbar using
getWindow ().setFlags (WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
in the main activity's onCreate.
This works, and hides the status bar just fine, until I add a YoutubeFragment and play a video. The moment the video loads, the status bar drops down, very annoying. I tried setting the flags all over the onInitializationSuccess listener, but no dice. The documentation doesn't mention the status bar on any non-full screen layout changes at all: https://developers.google.com/youtube/android/player/reference/com/google/android/youtube/player/YouTubePlayerFragment
Anyone any ideas?
Thanks in advance.
I don't know if you can put in manifest to hide action bar.
But try this function of Activity class
getActionBar().hide();
I was using a android 4.4.2 device to test with. With 4.1+ or higher there's another way to hide the status bar dynamically : http://developer.android.com/training/system-ui/status.html#41
//4.1+ Specific hiding of status bar
View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
I do not have the problem with the status bar popping up when adding a YoutubeFragment. Why the old code didn't work with YoutubeFragments, or even setting the Theme to
android:theme="#android:style/Theme.Holo.NoActionBar.Fullscreen"
, I have no idea though.

Android status bar - can it be transparent?

Can Android status bar be transparent like in iOS? I want it to blend into activity like on iOS. Can it be done and if yes - how?
EDIT: Just to clarify I need to make status bar transparent, not action bar, and yes I know I can completely hide it - but that's not what I'm asking.
No you can't make the system status bar transparent, and shouldn't try to do so in an attempt to mimic iOS:
Don't mimic UI elements from other platforms
Android 4.4 KitKit now allows translucent status and navigation bars:
http://developer.android.com/about/versions/android-4.4.html#UI
For example, you can set the theme as Theme.Holo.NoActionBar.TranslucentDecor.
You can make your activity fullscreen so you won't see the status bar.
Like this :
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.main);
Or set a theme like this
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
It can be done.
Take a look at the following library which basically implements a fading action bar, starting from fully transparent.
https://github.com/ManuelPeinado/FadingActionBar

Hide status bar on android

I am trying to hide the status bar. I have tried the following things.
This is for phones. I realize tablets can be different. It does hide the status bar when the layout has a bottom Tab. any ideas?
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
In the Manifest.XML I have added the above code.
And in the onCreate() I have added the followingin the right place:
requestWindowFeature(Window.FEATURE_NO_TITLE);
// hide statusbar of Android
// could also be done later
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);

Hide Status bar On a Tablet Running ICS

i want to hide status bar in tablet ics in my application
When i include this code. `
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
then the app crashed,
Is there any way to disable the status bar..
Or please give me a suggestion for hiding home button press
Do anyone have an idea in this topic,please help me tackling this problem
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(...);
First of all, share us your code. But I think the reason is that you put this line after setContentView(..) and you need to put it before

Android: Getting an issue of hiding title and status bar

I am hiding status bar and title bar throught out my app by adding
android:theme="#android:style/Theme.NoTitleBar" in android manifest xml file. I am also adding
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
in each activity. I am able to hide them. But sometimes when my app is loaded it is pushing the page down by taking the statusbar and title bar space.
Can any one of you please help me.
You should declare one of the above things not both. Either you declare it in the manifest or do it programmatically. Performing both the tasks as you just mentioned can hamper the screen. See this for more details
Declare any one of them and clean and run the program once..

Categories

Resources