To add a title bar in Android Studio, follow these steps:
Open your project in Android Studio.
In the Project pane on the left-hand side, navigate to the app > res > values folder.
Right-click the values folder and select New > Values resource file.
In the New Resource File dialog box, name the file styles.xml and click OK.
<?xml version="1.0" encoding="utf-8"?>
<resources><style name="AppTheme"
parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:windowActionBar">true</item>
<item name="android:windowTitleSize">35dp</item>
<item name="colorPrimary">#FF00BF</item>
</style></resources>
Apply the new theme to your activity by adding the following attribute to your activity in the AndroidManifest.xml file:
android:theme="@style/AppTheme"
Go to main file and add after onCreate():
ActionBar actionBar = getSupportActionBar();
actionBar.setTitle("Home Activity");