Reputation: 339
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.
Upvotes: 17
Views: 20264
Reputation: 1
By default, the MapsActivity
extends the FragmentActivity
, which does not have the getSupportActionBar
method.
MapsActivity
extends AppCompatActivity
.It worked for me and had no consequences at all in my code.
Upvotes: 0
Reputation: 321
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.
Upvotes: 1
Reputation: 636
Extending AppCompatActivity
instead of FragmentActivity
helped me.
Upvotes: 62
Reputation: 44158
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
.
Upvotes: 2