SupportMapFragment Instead of MapFragment

后端 未结 1 1708
广开言路
广开言路 2021-01-06 13:42

I want to make an android application that uses Google Maps for Android v2.

I can show a map. I can even navigate and zoom. But, when I want to search for more oper

1条回答
  •  生来不讨喜
    2021-01-06 14:01

    Is there a way of doing things like, "add marker", "show my current location", and "take position of the point that I clicked"? (using SupportMapFragment, of course. )

    Yes.

    Step #1: Add the Android Support package to your app.

    Step #2: Have your activities inherit from FragmentActivity from the Android Support package.

    Step #3: Change all MapFragment references (Java code and layout XML resources) to SupportMapFragment.

    And you're done.

    All of my Maps V2 samples use SupportMapFragment, in conjunction with ActionBarSherlock (which is why you will see SherlockFragmentActivity as opposed to FragmentActivity.

    0 讨论(0)
提交回复
热议问题