小编Tae*_*Kim的帖子

Android Studio Google Maps当我打开我的应用程序时,如何将相机重定向到我当前的位置

当我打开我的应用程序并且它也没有添加标记时,Camera Animation无法正常工作

 public class MapsActivity extends FragmentActivity {

private GoogleMap mMap; // Might be null if Google Play services APK is not available.



@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_maps);

}


@Override
protected void onResume() {
    super.onResume();
    setUpMapIfNeeded();
}
Run Code Online (Sandbox Code Playgroud)

在这里它不会将我的相机指向我当前的位置.当我打开我的应用程序时,它从地图的中心开始而不是我的位置

private void setUpMapIfNeeded() {
    // Do a null check to confirm that we have not already instantiated the map.
    if (mMap == null) {
        // Try to obtain the map from the SupportMapFragment.
        mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map))
                .getMap();
        mMap.setMyLocationEnabled(true); …
Run Code Online (Sandbox Code Playgroud)

android google-maps

0
推荐指数
1
解决办法
3179
查看次数

标签 统计

android ×1

google-maps ×1