如果用户打开地图,则显示静态位置,然后在当前位置移动10秒标记。 请尽快帮助我
答案 0 :(得分:-1)
你可以在线程中启动计时器,10秒后完成通话方法以显示当前位置,
线程代码: -
公共类CounterClass扩展了CountDownTimer {
public CounterClass(long millisInFuture, long countDownInterval) {
super(millisInFuture, countDownInterval);
}
@Override
public void onFinish() {
// textViewTime.setText("Completed.");
}
}
位置: -
LatLng HAMBURG = new LatLng(Double.valueOf(val),Double.valueOf(longValue));
FragmentManager myFM = getActivity().getSupportFragmentManager();
myMAPF = (SupportMapFragment) myFM
.findFragmentById(R.id.mapDetailview);
//System.out.println("SupportMapFragment is " + myMAPF);
//System.out.println("Map is " + myMAPF);
map = myMAPF.getMap();
LatLng KIEL = new LatLng(Double.valueOf(val),Double.valueOf(longValue));
Marker hamburg = map.addMarker(new MarkerOptions().position(
HAMBURG).title(""));
Marker kiel = map.addMarker(new MarkerOptions()
.position(KIEL)
.title("Hello")
.snippet("Kiel is cool")
);
map.moveCamera(CameraUpdateFactory.newLatLngZoom(HAMBURG, 14));
// Zoom in, animating the camera.
map.animateCamera(CameraUpdateFactory.zoomTo(10), 2000, null);
您可以根据自己的要求更改代码,此代码仅供参考。