ActionBarCompat and MapActivity

2019-08-18 03:26发布

问题:

I've successfully converted most of my app to use ActionBarCompat by extending ActionBarActivity on most activities, however... I have a MapActivity class and need this to work here as well.

How would I go about creating a new class based on ActionBarActivity and having it extend MapActivity and would that even work?

The sample that Google provides in the ../samples/android-17/ActionBarCompat directory has a lot of these java files (ActionBarActivity.java, etc.) but also tons of required layouts, styles, drawables, etc., etc. and I wasn't sure if adding all of those files to my project is the only way to get this one map screen to work. Seems like there has to be a better way right?

回答1:

You can't create an activity that inherits from both. You'll have to create a MapFragment.