Java 安卓:谷歌地图没有显示正确的位置

Java 安卓:谷歌地图没有显示正确的位置,java,android,google-maps,Java,Android,Google Maps,我试图在我的应用程序中显示谷歌地图,但我的地图似乎没有显示正确的位置,如下所示 这是我的代码: public class Frag_Contact extends Fragment implements OnMapReadyCallback { SupportMapFragment mMapFragment; LatLng MAP_MAIN = new LatLng(1.254337, 103.823776); View rootView; public Frag

我试图在我的应用程序中显示谷歌地图,但我的地图似乎没有显示正确的位置,如下所示

这是我的代码:

public class Frag_Contact extends Fragment implements OnMapReadyCallback {
    SupportMapFragment mMapFragment;
    LatLng MAP_MAIN = new LatLng(1.254337, 103.823776);
    View rootView;
    public Frag_Contact(){

}

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        ((MainActivity) getActivity()). custom_searchbox();
        rootView = inflater.inflate(R.layout.fragment_contact, container, false);
        mMapFragment = ((SupportMapFragment)getChildFragmentManager().findFragmentById(R.id.map_kantor));
        mMapFragment.getMapAsync(this);
        return rootView;
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
    }
    @Override
    public void onDestroyView() {
        super.onDestroyView();
        Fragment fragment = (getChildFragmentManager().findFragmentById(R.id.map_kantor));
        getActivity().getSupportFragmentManager().beginTransaction().remove(fragment).commit();

    }

    @Override
    public void onAttach(Activity activity) {
        super.onAttach(activity);
    }

    @Override
    public void onDetach() {
        super.onDetach();
    }


    @Override
    public void onMapReady(GoogleMap googleMap) {
        googleMap.setMyLocationEnabled(true);
        googleMap.addMarker(new MarkerOptions().position(MAP_MAIN).title("SINARMAS"));
        googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(MAP_MAIN, 15));
        googleMap.animateCamera(CameraUpdateFactory.zoomTo(0), 2000, null);
    }
}
这是我的布局:

<LinearLayout
android:id="@+id/child_home"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingBottom="30dp"
android:orientation="vertical">

<fragment
    android:id="@+id/map_kantor"
    android:layout_width="fill_parent"
    android:layout_height="150dp"
    android:layout_margin="10dp"
    android:name="com.google.android.gms.maps.SupportMapFragment" />

这是我的清单:

    <permission
    android:name="id.co.application.permission.MAPS_RECEIVE"
    android:protectionLevel="signature" />

<uses-feature
    android:glEsVersion="0x00020000"
    android:required="true" />
<uses-permission android:name="id.co.ajsmsig.e_sehat.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CALL_PHONE"/>
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/MyMaterialTheme" >
    <activity
        android:name=".activity.Splash"
        android:screenOrientation="portrait"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <activity
        android:name=".activity.MainActivity"
        android:screenOrientation="portrait"
        android:configChanges="orientation"
        android:noHistory="true"/>

    <meta-data
        android:name="com.google.android.maps.v2.API_KEY"
        android:value="@string/api" />
</application>


似乎我的地图没有显示我想要的正确位置,我的应用程序中的地图也没有显示完整的地图,正如您在上面看到的,它只是我的应用程序中显示的地图的一半,我希望有人理解我的意思,并帮助我解决我的问题。非常感谢。

没有显示正确的位置吗?也许你颠倒了纬度和逻辑度。。。如您所见,我在主地图中有正确的
纬度
经度
,请尝试删除
animateCamera
,并告知是否有任何更改(同时确保您有互联网连接)?@hrskrs很好。。。这是工作!!!!最后非常感谢:)