Reputation: 1701
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.
Upvotes: 0
Views: 4609
Reputation: 1
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
Upvotes: 0
Reputation: 3676
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
Upvotes: 5
Reputation: 4487
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">
Upvotes: 0
Reputation: 220
you can add this line in the activities you want inside manifest file
android:theme="@android:style/Theme.NoTitleBar"
Upvotes: 0
Reputation: 9870
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);
}
Upvotes: 0