当前位置: 首页>>代码示例>>Java>>正文


Java MapView.getMap方法代码示例

本文整理汇总了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;
}
 
开发者ID:sherlockchou86,项目名称:yphoto,代码行数:25,代码来源:MapFragmentSimple.java

示例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);

}
 
开发者ID:zhuyu1022,项目名称:amap,代码行数:17,代码来源:AmapManager.java

示例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();
    }


}
 
开发者ID:jiangzehui,项目名称:xmpp,代码行数:25,代码来源:LocationActivity.java

示例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();


}
 
开发者ID:Alex-ZHOU,项目名称:VMAndroid,代码行数:27,代码来源:RecordDBActivity.java

示例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));
    }
}
 
开发者ID:laoqiu,项目名称:react-native-amap,代码行数:20,代码来源:AMapViewManager.java

示例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);
        }
    }
}
 
开发者ID:laoqiu,项目名称:react-native-amap,代码行数:22,代码来源:AMapViewManager.java

示例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);//隐藏放大按钮
}
 
开发者ID:CKTim,项目名称:MyApplication,代码行数:24,代码来源:ShopMapActivity.java

示例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);
}
 
开发者ID:gghyoo,项目名称:CarPathRecorder,代码行数:24,代码来源:MainActivity.java

示例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);
}
 
开发者ID:shensky711,项目名称:Run-With-You,代码行数:18,代码来源:LocationActivity.java

示例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);

}
 
开发者ID:Tsroad,项目名称:Road,代码行数:25,代码来源:GeoFenceActivity.java

示例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);

	}
 
开发者ID:amapapi,项目名称:Android_UsingCar_Example,代码行数:23,代码来源:MainActivity.java

示例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();
		}
	}
}
 
开发者ID:flsf,项目名称:WHUMap,代码行数:25,代码来源:MyMapFragment.java

示例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();
}
 
开发者ID:ruiqiao2017,项目名称:Renrentou,代码行数:14,代码来源:MapTestActivity.java

示例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();
                }
        });
}
 
开发者ID:HelloChenJinJun,项目名称:TestChat,代码行数:30,代码来源:MapActivity.java

示例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();
}
 
开发者ID:KellenHu,项目名称:Amap-Move-Example,代码行数:15,代码来源:MainActivity.java


注:本文中的com.amap.api.maps.MapView.getMap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。