How to get Google Maps object inside a Fragment

前端 未结 7 1943
走了就别回头了
走了就别回头了 2021-02-19 01:26

I am using fragments in my application and I am new for this. There is a fragment in which I want to display Google Map and want to get its object, for this I have a fragment in

相关标签:
7条回答
  • 2021-02-19 02:12

    Try this it works for me How to put Google Maps V2 on a Fragment Using ViewPager

    <Fragment
                android:id="@+id/map"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                class="com.google.android.gms.maps.SupportMapFragment" />
    
    GoogleMap mGoogleMap = ((SupportMapFragment) getChildFragmentManager().findFragmentById(R.id.map)).getMap();
    
    0 讨论(0)
提交回复
热议问题