本文整理汇总了Java中com.amap.api.maps.MapView.getMap方法的典型用法代码示例。如果您正苦于以下问题:Java MapView.getMap方法的具体用法?Java MapView.getMap怎么用?Java MapView.getMap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.amap.api.maps.MapView
的用法示例。
在下文中一共展示了MapView.getMap方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreateView
import com.amap.api.maps.MapView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View sView = inflater.inflate(R.layout.fragment_map_simple, container, false);
mMapView = (MapView) sView.findViewById(R.id.map_simple);
mMapView.onCreate(savedInstanceState);
AMap map = mMapView.getMap();
map.setMapType(AMap.MAP_TYPE_NIGHT);
map.getUiSettings().setZoomControlsEnabled(false);
map.getUiSettings().setAllGesturesEnabled(false);
LatLng loc = new LatLng(39.9793157, 116.3107618);
CameraUpdate mCameraUpdate = CameraUpdateFactory.newCameraPosition(new CameraPosition(loc,14 ,0,0));
map.animateCamera(mCameraUpdate, 1000, null);
if(mCircleTask == null) {
mCircleTask = new CircleTask(map, loc, 15, 20, 40);
}
return sView;
}
示例2: AmapManager
import com.amap.api.maps.MapView; //导入方法依赖的package包/类
public AmapManager(Context conext, MapView mapView) {
this.mContext = conext;
dbManager = new MapDatebaseManager(conext);
if (aMap == null) {
aMap = mapView.getMap();
}
//设置线段属性
polylineOptions = new PolylineOptions().width(10).color(lineColor);
//设置锚点属性锚点
markerOptions = new MarkerOptions();
// 绑定 Marker 被点击事件
aMap.setOnMarkerClickListener(markerClickListener);
//绑定信息窗点击事件
aMap.setOnInfoWindowClickListener(infoWindowClicklistener);
}
示例3: onCreate
import com.amap.api.maps.MapView; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_location);
mapView = (MapView) findViewById(R.id.map_route);
mlist = (ListView) findViewById(R.id.location_listView);
ll_back= (LinearLayout) findViewById(R.id.location_layout_back);
ll_back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
mlist.setOnItemClickListener(this);
mapView.onCreate(savedInstanceState);
if (aMap == null) {
aMap = mapView.getMap();
aMap.setOnCameraChangeListener(this);
setUpMap();
}
}
示例4: onCreate
import com.amap.api.maps.MapView; //导入方法依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.i(TAG, "onCreate: ");
setContentView(R.layout.activity_voice_db_record_db);
mMapView = (MapView) findViewById(R.id.record_db_map_view);
mMapView.onCreate(savedInstanceState);// 此方法必须重写
AMap mAMap = mMapView.getMap();
mAMap.setLocationSource(this);// 设置定位监听
mAMap.setOnMapLoadedListener(this);
//mAMap.getUiSettings().setMyLocationButtonEnabled(true);// 设置默认定位按钮是否显示
mAMap.setMyLocationEnabled(true);// 设置为true表示显示定位层并可触发定位,false表示隐藏定位层并不可触发定位,默认是false
RecordDBFragment fragment = RecordDBFragment.newInstance();
FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction transaction = fragmentManager.beginTransaction();
transaction.replace(R.id.record_db_fl, fragment);
transaction.commit();
}
示例5: setRegion
import com.amap.api.maps.MapView; //导入方法依赖的package包/类
@ReactProp(name = "region")
public void setRegion(MapView mapView, @Nullable ReadableMap region) {
if (region == null) return;
AMap map = mapView.getMap();
Double lat = region.getDouble("latitude");
Double lng = region.getDouble("longitude");
Double lngDelta = region.getDouble("longitudeDelta");
Double latDelta = region.getDouble("latitudeDelta");
LatLngBounds bounds = new LatLngBounds(
new LatLng(lat - latDelta / 2, lng - lngDelta / 2), // southwest
new LatLng(lat + latDelta / 2, lng + lngDelta / 2) // northeast
);
if (mapView.getHeight() <= 0 || mapView.getWidth() <= 0) {
map.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(lat, lng), 10));
boundsToMove = bounds;
} else {
map.animateCamera(CameraUpdateFactory.newLatLngBounds(bounds, 0));
}
}
示例6: addFeature
import com.amap.api.maps.MapView; //导入方法依赖的package包/类
public void addFeature(MapView parent, View child, int index) {
AMap map = parent.getMap();
if (child instanceof AMapMarker) {
AMapMarker annotation = (AMapMarker) child;
annotation.addToMap(map);
features.add(index, annotation);
Marker marker = (Marker) annotation.getFeature();
markerMap.put(marker, annotation);
} else if (child instanceof AMapPolyline) {
AMapPolyline polylineView = (AMapPolyline) child;
polylineView.addToMap(map);
features.add(index, polylineView);
Polyline polyline = (Polyline) polylineView.getFeature();
polylineMap.put(polyline, polylineView);
} else {
ViewGroup children = (ViewGroup) child;
for (int i = 0; i < children.getChildCount(); i++) {
addFeature(parent, children.getChildAt(i), index);
}
}
}
示例7: onCreate
import com.amap.api.maps.MapView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.shopmap_activity);
ManageActivityUtils.addActivity(this);
//如果安卓5.0设置状态栏为orange
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
getWindow().setStatusBarColor(getResources().getColor(R.color.orange));
}
//初始化各个控件ID
initID();
//先初始化mapview,是地图能正常显示出来
mapView = (MapView) this.findViewById(R.id.map);
mapView.onCreate(savedInstanceState);
//得到amap
aMap = mapView.getMap();
aMap.setLocationSource(this);// 设置定位监听
aMap.getUiSettings().setMyLocationButtonEnabled(true);// 设置默认定位按钮是否显示
aMap.setMyLocationEnabled(true);// 设置为true表示显示定位层并可触发定位,false表示隐藏定位层并不可触发定位,默认是false
aMap.setMyLocationType(AMap.LOCATION_TYPE_LOCATE);
mUiSettings=aMap.getUiSettings();
mUiSettings.setZoomControlsEnabled(false);//隐藏放大按钮
}
示例8: onCreate
import com.amap.api.maps.MapView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
findViewById(R.id.fab).setOnClickListener(this);
mPopupMenu = new PopupMenu(this, findViewById(R.id.fab));
mPopupMenu.getMenuInflater().inflate(R.menu.menu_main, mPopupMenu.getMenu());
mPopupMenu.setOnMenuItemClickListener(this);
mapView = (MapView) findViewById(R.id.map);
mapView.onCreate(savedInstanceState);// 必须要写
if (aMap == null) {
aMap = mapView.getMap();
setUpMap();
}
startLocationService();
mDownloadInfoBar = (LinearLayout) findViewById(R.id.downloadInfoBar);
mDownloadInfoBar.setVisibility(View.GONE);
}
示例9: onCreate
import com.amap.api.maps.MapView; //导入方法依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_test);
//获取地图控件引用
mMapView = (MapView) findViewById(R.id.map);
//在activity执行onCreate时执行mMapView.onCreate(savedInstanceState),创建地图
mMapView.onCreate(savedInstanceState);
AMap aMap = mMapView.getMap();
aMap.setMapType(AMap.MAP_TYPE_NORMAL);
// 设置定位监听
aMap.setLocationSource(this);
// 设置为true表示显示定位层并可触发定位,false表示隐藏定位层并不可触发定位,默认是false
aMap.setMyLocationEnabled(true);
// 设置定位的类型为定位模式,有定位、跟随或地图根据面向方向旋转几种
aMap.setMyLocationType(AMap.LOCATION_TYPE_LOCATE);
}
示例10: onCreate
import com.amap.api.maps.MapView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//引入地图
setContentView(R.layout.fence_trace);
mapView = (MapView) findViewById(R.id.trace_mapView);
mapView.onCreate(savedInstanceState);
//设置监听
mMap= mapView.getMap();
mMap.setOnMapClickListener(this);
//构建定位控制类
mLocationManagerProxy = LocationManagerProxy.getInstance(this);
//构建地理围栏广播
Intent intent = new Intent(GEOFENCE_BROADCAST_ACTION);
mPendingIntent = PendingIntent.getBroadcast(getApplicationContext(), 0,intent, 0);
IntentFilter intentFilter= new IntentFilter();
intentFilter.addAction(GEOFENCE_BROADCAST_ACTION);
this.registerReceiver(mGeoFenceReceiver,intentFilter);
mLocationManagerProxy.requestLocationData(LocationProviderProxy.AMapNetwork, 2000, 15,this);
}
示例11: init
import com.amap.api.maps.MapView; //导入方法依赖的package包/类
private void init(Bundle savedInstanceState) {
mAddressTextView = (TextView) findViewById(R.id.address_text);
mDestinationButton = (Button) findViewById(R.id.destination_button);
mDestinationButton.setOnClickListener(this);
mMapView = (MapView) findViewById(R.id.map);
mMapView.onCreate(savedInstanceState);
mAmap = mMapView.getMap();
mAmap.getUiSettings().setZoomControlsEnabled(false);
mAmap.setOnMapLoadedListener(this);
mAmap.setOnCameraChangeListener(this);
mDestinationContainer = (LinearLayout) findViewById(R.id.destination_container);
mRouteCostText = (TextView) findViewById(R.id.routecost_text);
mDesitinationText = (TextView) findViewById(R.id.destination_text);
mDesitinationText.setOnClickListener(this);
mLocationImage = (ImageView) findViewById(R.id.location_image);
mLocationImage.setOnClickListener(this);
mFromToContainer = (LinearLayout) findViewById(R.id.fromto_container);
mCancelButton = (Button) findViewById(R.id.cancel_button);
}
示例12: initMapView
import com.amap.api.maps.MapView; //导入方法依赖的package包/类
/**
* 初始化MapView
*
* @param v
* @param savedInstanceState
*/
private void initMapView(View v, Bundle savedInstanceState) {
mapView = (MapView) v.findViewById(R.id.map);
mapView.onCreate(savedInstanceState);
myLocation = new MyLocation();
mBuildingMarker = new BuildingMarker();
mVolunteerMarker = new VolunteerMarker();
myMapClick = new MyMapClick();
if (aMap == null) {
aMap = mapView.getMap();
aMap.moveCamera(CameraUpdateFactory.newCameraPosition(WHUS));
if (CURP == null) {
showLocationDialog();
myLocation.setUpMap();
}
}
}
示例13: onCreate
import com.amap.api.maps.MapView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_map_test);
//获取地图控件引用
mMapView = (MapView) findViewById(R.id.map);
//在activity执行onCreate时执行mMapView.onCreate(savedInstanceState),创建地图
mMapView.onCreate(savedInstanceState);
if (aMap == null) {
aMap = mMapView.getMap();
}
initLocation();
}
示例14: initView
import com.amap.api.maps.MapView; //导入方法依赖的package包/类
@Override
public void initView() {
LogUtil.e("222123213mapInitView");
send = (Button) findViewById(R.id.btn_map_send);
back = (Button) findViewById(R.id.btn_map_back);
display = (MapView) findViewById(R.id.mv_display);
type = (Button) findViewById(R.id.btn_map_type);
if (display != null) {
display.onCreate(savedInstanceState);
}
send.setOnClickListener(this);
back.setOnClickListener(this);
type.setOnClickListener(this);
if (mMap == null) {
mMap = display.getMap();
}
mMap.setOnMapLoadedListener(new AMap.OnMapLoadedListener() {
@Override
public void onMapLoaded() {
mMap.setOnMapLoadedListener(null);
LogUtil.e("视图加载完成1111122111");
send.setClickable(true);
type.setClickable(true);
LogUtil.e("1浏览更新");
updateMarkerLocation();
}
});
}
示例15: onCreate
import com.amap.api.maps.MapView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mMapView = (MapView) findViewById(R.id.map);
text = (TextView) findViewById(R.id.text);
mMapView.onCreate(savedInstanceState);
mAmap = mMapView.getMap();
mAmap.getUiSettings().setScaleControlsEnabled(true);// 设置地图默认的比例尺是否显示
initRoadData();
moveLooper();
}