Manan Mehta
Manan Mehta

Reputation: 5929

I am struggling to add an action bar

I have gone through quite a few tutorials and I still can't figure out how to add a simple action bar to my android app. I am very much a beginner and a little help would mean a lot.

(I started my app with the Empty activity template) My main activity is called MainMenu and it displays the activity_main_menu.xml file. I made a new folder in resources called menu and I am stuck now.

Upvotes: 1

Views: 52

Answers (1)

Ihor Bykov
Ihor Bykov

Reputation: 1938

Add to your activity style in styles.xml

 <style name="Theme_Base_App" parent="Base.Theme.AppCompat.Light.DarkActionBar">
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
</style>

and in manifest

android:theme="@style/Theme_Base_App"

Upvotes: 2

Related Questions