Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding an ActionBar to the Default Google Maps Activity Template in Android Studio

I've been able to add all of my markers to my map, using locations provided by my API, but I've been unable to add an ActionBar.

As mentioned, I am using the Android Studio "Google Maps Activity" template. How can I go about adding an ActionBar to this template?

Please let me know if there's any code that you need from me.

like image 600
ztnark Avatar asked Jan 16 '15 18:01

ztnark


3 Answers

Extending AppCompatActivity instead of FragmentActivity helped me.

like image 152
GeorgeK Avatar answered Oct 17 '22 20:10

GeorgeK


Since your minSdk is 18, you shouldn't be using the support theme (AppCompat). Change it to holo:

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
</style>

Also make sure your activities extend Activity or FragmentActivity.

like image 2
Simas Avatar answered Oct 17 '22 21:10

Simas


I followed this example https://developer.android.com/training/appbar/setting-up.html and I changed my coordinator layout to relative layout so that I could position my map fragment and other buttons below the toolbar.

like image 1
Galileo Avatar answered Oct 17 '22 20:10

Galileo