-1

I am new to android and trying to create a title area and title for my app. what I have is this: enter image description here

What I am aiming for is something like this: enter image description here

When I look at the XML for each of these the constraint xml is identical. Can some one help me add a title block to #1.

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"

Thank you.

Abdul Waheed
  • 4,540
  • 6
  • 35
  • 58
Tony Sherman
  • 285
  • 1
  • 6
  • 18
  • 1
    That is a toolbar and can either be declared usign a tag if you have the support library, or just changing to a theme that has an actionbar – Zoe Oct 19 '17 at 14:08
  • Possible duplicate of [How to change the text on the action bar](https://stackoverflow.com/questions/3438276/how-to-change-the-text-on-the-action-bar) – William-H-M Oct 19 '17 at 14:11
  • Possible duplicate of [Adding ActionBar in Android Activity](https://stackoverflow.com/questions/34238416/adding-actionbar-in-android-activity) – Zoe Oct 19 '17 at 14:14
  • and https://stackoverflow.com/questions/39052127/how-to-add-an-actionbar-in-android-studio-for-beginners – Zoe Oct 19 '17 at 14:15
  • I see what you guys are saying, but in the 2nd example the title is just there by default. Is there anyway I can do this in XML for my initial layout? – Tony Sherman Oct 19 '17 at 14:19
  • Go to your project `res` folder then `values` then `style` and inside the style folder copy and paste the contents in your question and then we can see what is going on! And change it from xml. Also adding your manifest file contents is helpful – Xenolion Oct 19 '17 at 14:26
  • @Xenolion as soon as you said that, I looked in the Style and it had NoActionBar. Changed that and it worked a treat. Thank you. If you write that as a solution, I'd happily accept it. Thank you. – Tony Sherman Oct 19 '17 at 14:33
  • Okay thanks, I am glad it worked It happened to me too when I started Android Development. Thats why I remember that. – Xenolion Oct 19 '17 at 14:36

1 Answers1

2

Change your AppTheme from styles folder from .NoActionBar to another parent with ActionBar for example .DarkActionBar.

Xenolion
  • 12,035
  • 7
  • 33
  • 48