what theme should I use to hide the notification bar but show the action bar? (Like calculator on Samsung phones)
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
Use this with Theme holo
**you have to do it through coding add this before setContentView() **
Related
I have an activity in my app, which is using swipeable tabs with action bar
For example :-
this tutorial
So my question is to add action bar to my activity and remove titlbar
similar question
I'm unsure as to exactly what you class as a title bar but you could do this in XML by putting the following in your Android Manifest for a particular activity to remove your title bar.
android:theme="#android:style/Theme.Black.NoTitleBar.Fullscreen
Add this to your activity before calling setContentView();
this.requestWindowFeature(Window.FEATURE_ACTION_BAR | Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
if that dosen't work try this
//use this to disable the icon from ActionBar
getActionBar().setDisplayShowHomeEnabled(false);
//use this to disable the application name from ActionBar
getActionBar().setDisplayShowTitleEnabled(false);
Use this code in oncreate() method of activity before adding content:
getWindow().requestFeature(Window.FEATURE_NO_TITLE)
I am working on titanium project and am facing a problem where when I use win.open({modal:true}); my application screen does not hide the status bar and title bar in Android devices. How can I fix this?
to hid ethe title bars in your screen just do this in your oncreate before adding the setcontentview.This will hide your title bar
requestWindowFeature(Window.FEATURE_NO_TITLE);
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
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);
In my application i am working with canvas. I am drawing on canvas. I put canvas color as white. When my app open the canvas is visible along with above status bar.
But i want my canvas should take the full screen. means that Notification status bar should disapear when i run that app bt not the title bar(bcz i m using some custom title bar)
How can i do that?
By using below code i gave custom title,
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.custom_title);
Now i am trying to hide status bar using below code in activity-
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
and in AndroidManifest.xml
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
But it shows force close.
Give me a way how to do that?
It's enough to remove the line
requestWindowFeature(Window.FEATURE_NO_TITLE);
But if you want to display full screen (without action bar) write too
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_location_eb);
You can't use Window.FEATURE_CUSTOM_TITLE after setting Theme.NoTitleBar. It's enough to use just this theme. Do not set all these flags in code.
EDIT: Seems I misunderstood your question. I read it again carefully and now I see you're asking about Android 2.x and its notification bar. Your onCreate() method should look like this:
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.name);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.custom_title);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
You mustn't set Theme.NoTitleBar or Theme.NoTitleBar.Fullscreen for this activity. Just use the default Theme or don't specify any theme at all.
Am going to tell you how to tackle the title bar and the system notification panel individually and perfectly.
Use one or both as per Your Need.
1.Do not apply any theme to the Activity through XML.
2.Now, go the corr. Java file and add these lines
inside onCreate()..
after super.onCreate()..
Part.a. to remove just Title Bar
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
Part.b. to remove the System notification panel
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
Do not forget to follow them with the usual
setContentView(R.layout.activity_layout_name);