I am new in android programming. Recently I have working in a android apps. I notice that when I run my apps in my phone it shows Activity name in top of the apps. Even if I go to my second activity it shows second activity name. How I can stop it? Please suggest me.
-
6possible duplicate of [No Title Bar Android Theme](http://stackoverflow.com/questions/14692808/no-title-bar-android-theme) – M D Jun 20 '14 at 06:50
-
Do you want to hide ActionBar or you want to write you own title here? – Alexander Mikhaylov Jun 20 '14 at 06:54
-
You can remove that bar using two way one is using code and another by changing theme. If you want to remove it from full application use `android:theme="@android:style/Theme.Black.NoTitleBar"` in Manifest under application. – Mobi Jun 20 '14 at 07:03
5 Answers
Try this in your Activity
's onCreate()
, it will remove that bar, and it is called ActionBar
.
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_main);
}
Edit:
If you want to remove it from whole app, try this.
Open your AndroidManifest.xml file and add this in your application
tag
android:theme="@android:style/Theme.Holo.NoActionBar"
Here you can use any variant as per your existing theme style like Theme.Holo.Light
to Theme.Holo.Light.NoActionBar
or Theme.Holo.Dark.
to Theme.Holo.Dark.NoActionBar
or Theme.NoTitleBar
if you don't have any custom theme as suggeted by Aniruddha.
Check this SO answer if you have custom theme: https://stackoverflow.com/a/10318745/1765573

- 1
- 1

- 3,558
- 3
- 31
- 40
-
you need to do no.theme in the activity tag in the manifest otherwise you still will have a title flash at application startup. – Aniruddha Jun 20 '14 at 07:24
-
@Aniruddha: thanks for pointing out, yes it will be shown for a moment on start up if you add it from java file. I edited my answer and add the code for AndroidManifest.xml file. – dakshbhatt21 Jun 20 '14 at 08:44
You should hide the title, for that you need to add requestWindowFeature(Window.FEATURE_NO_TITLE);
before setContentView()
in activity.
And you need to do no.theme in the activity tag in the manifest otherwise you still will have a title flash at application startup.
EDIT
If you want to remove title bar from every activity then you can do the following
<application android:name=".AppName"
android:label="@string/app_name"
android:icon="@drawable/ic_launcher"
android:theme="@android:style/Theme.NoTitleBar">

- 4,477
- 2
- 21
- 39
-
,shall we put this line Master Activity instead of every Activity what you think about it ? – Haresh Chhelana Jun 20 '14 at 07:02
-
It is not really clear what You mean by Activity name. Could You show us what You mean? Usually, it is normal that on every app, the app name is above. This is defined in the manifest.xml like this:
<activity
android:label="@string/app_name" <--this is the name You can change
.
.
.
</activity>
To avoid displaying this name, You can set some flags after onCreate in Your activities:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.main);
}

- 3,558
- 3
- 31
- 40

- 9,800
- 2
- 36
- 49
you can add this line in the activities you want inside manifest file
android:theme="@android:style/Theme.NoTitleBar"

- 210
- 1
- 4
- 12
To change that to the app's name or any other name of your choice, open AndroidManifest.xml file of your application, there for every activity, you will find such pieces of code
<activity></activity> OR <activity android:name=".activityname" />
change that to--> suppose your activity name is 'abc'
<activity>
android:name=".abc"
android:label="whatever name you want"
</activity>
you can either hard-code the strings or use them from string.xml file