Reputation: 16002
I'm beginning to learn Android Development and I have a bar at the top of my app, containing the title of the activity and the app icon. I want to know how to edit it (change the text, background color, etc), and remove it ? I also want to know how to edit the title of my app, because it's currently the name of its main activity...
Thanks a lot.
Upvotes: 0
Views: 4633
Reputation: 32269
Edit your AndroidManifest.xml
<application
android:icon="@drawable/icon"
android:label="@string/app_label"
>
...
<activity
android:name="foo.MyActivity"
android:label="@string/activity_label" >
</activity>
</application>
If you don't want any titlebar, add the attribute:
android:theme="@android:style/Theme.NoTitleBar"
To the application tag.
Upvotes: 1
Reputation: 1007494
I want to know how to edit it (change the text, background color, etc), and remove it ?
If your android:targetSdkVersion
is API Level 11+, that is called the action bar. You can get an ActionBar
object by calling getActionBar()
in your activity (or getSupportActionBar()
if you are using ActionBarSherlock). There are a series of methods on there for stuff like whether the title is to be displayed or not.
also want to know how to edit the title of my app, because it's currently the name of its main activity
As lxx notes, your manifest has android:label
attributes for the <application>
and <activity>
, which point to string resources. You can change the values in the string resources to be something else. For activity titles, you can also change them at runtime by calling setTitle()
on your Activity
.
Upvotes: 2
Reputation: 5640
If you mean 'Title Bar' as the bar on the top of the screen, that could be removed by adding the following line to your Manifest
android:theme="@android:style/Theme.NoTitleBar"
Add that to the application tag as follows:
<application
android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar">
Upvotes: 2