I have different Activities
in my App and in all of them I do not want the Action Bar
. I cannot find how to disable it. I have tried to find an attribute to apply it to the main_activity.xml
but so far I did not find anything. Can somebody help me please?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How can I create this custom Bottom Navigation on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
Considering everyone is posting older ways of hiding the ActionBar here is the proper way of implementing it within styles for AppCompat support library. Which I highly suggest moving toward if you haven't already.
Simply removing the ActionBar
If you are using the appcompat support libraries, this is the easiest and recommended way of hiding the ActionBar to make full screen or start implementing to toolbar within your layouts.
Then to change your toolbar color
Last note: Your Activity class should extend AppCompatActivity
If you're using
AppCompat
, declare your activity inAndroidManifest.xml
as follows:I will try to show it as simple as i can:
DECLARE FULL SCREEN ACTIVITY IN ANDROID MAINIFEST file:
Now in Android studio (if you using it) open your Activity xml file ( in my example activity_game.xml) in designer and select theme (above mobile phone in designer click button with small circle) and then select Mainfest Themes on the left side and then NoTitleBar.Fullscreen.
Hope it will help!
open Manifest and add attribute theme = "@style/Theme.AppCompat.Light.NoActionBar" to activity you want it without actionbar :
There are multiple ways of doing this.
1) Change the theme in Android Manifest
Below the Application element, you will find theme tag. Replace it with this one -
If you are using AppCompat, use
@android:style/Theme.AppCompat.NoActionBar
.This will set the theme for all activities. If you don't need the action bar in a specific acitivity, then set the theme in the activity container, ie
You may also set
android:theme="@android:style/Theme.NoTitleBar"
theme in the styles and use it later on.2) Create a Custom Theme
Add this in
res/values/styles.xml
and then set it as your activity's theme in Manifest:
3) Dynamically Remove the Action Bar
Put this code in the
onCreate
method before setting content view -If you are using the support library use
getSupportActionBar()
.Please find the default theme in styles.xml
And change parent this way