Hey all I’d like help in creating my app in android studio I am new to this so I’ll do my best to try and help you all understand best into what I am trying to do.
I am going to post two pics of how my design should look and I can’t seem to get the start of the title bar done. In android studio it always on all of the project start-ups puts a black title bar with a picture of an android and its all black id like it to be cleared of the photo and re colour’d into red and the title text center’d as in my design image.
any help would be much appreciated
this should show the two pictures of my design
2
Answers
Action bar custom label
AndroidManifest.xml:
You can change the
android:label
from your app name to your desired title for each activity you have.Action bar background color
To change the action bar background, create a custom theme for your activity that overrides the actionBarStyle property. This property points to another style in which you can override the background property to specify a drawable resource for the action bar background.
Styling the Action Bar
While you can edit the xml to change the ActionBar, your best bet is going to be using the new
Toolbar
. A toolbar is a fully customizableActionBar
without a lot of the traditional constraints of it. You can treat the toolbar just like any other layout container and include layout elements inside like TextViews, etc.After you have designed your toolbar in xml, you can simply set the toolbar to be your action bar by calling
activity.setSupportActionBar(yourToolbar);
This is much more flexible and allows much more control over the look and feel than using the traditional action bar.