当前位置:首页 > Windows程序 > 正文

调用高德地图Api

2024-03-31 Windows程序

标签:

Xml文件
<com.amap.api.maps.MapView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mapView"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</com.amap.api.maps.MapView>

Java代码 public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
if (mapLayout == null) {
mapLayout = inflater.inflate(R.layout.map_fragment, null);
mapView = (MapView) mapLayout.findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState);
if (aMap == null) {
aMap = mapView.getMap();
aMap.setMapType(AMap.MAP_TYPE_SATELLITE);// 设置卫星地图模式,aMap是地图控制器对象。
}
}else {
if (mapLayout.getParent() != null) {
((ViewGroup) mapLayout.getParent()).removeView(mapLayout);
}
}
RealTimePositionVelocityCalculator currentPositionVelocityCalculator =
mPositionVelocityCalculator;
if (currentPositionVelocityCalculator != null) {
currentPositionVelocityCalculator.setMapFragment(this);
}

return mapLayout;
}

调用高德地图Api

标签:

原文地址:https://www.cnblogs.com/blogger-Li/p/11616857.html

温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/file/9051.html

Jm-杰米博客Jamie
草根站长的技术交流乐园!IT不会不要紧快来好好学习吧!
  • 20786文章总数
  • 7494585访问次数
  • 建站天数
  • 友情链接