Java Code Examples for com.amap.api.maps.model.MarkerOptions#draggable()
The following examples show how to use
com.amap.api.maps.model.MarkerOptions#draggable() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MapActivity.java From TikTok with Apache License 2.0 | 5 votes |
private void initMarks() { MarkerOptions markerOption = new MarkerOptions(); markerOption.position(latlng); markerOption.title("西安市").snippet("西安市:34.341568, 108.940174"); markerOption.draggable(true);//设置Marker可拖动 markerOption.icon(BitmapDescriptorFactory.fromBitmap(BitmapFactory .decodeResource(getResources(),R.mipmap.ic_launcher))); // 将Marker设置为贴地显示,可以双指下拉地图查看效果 markerOption.setFlat(true);//设置marker平贴地图效果 mAMap.addMarker(markerOption); }
Example 2
Source File: AMapMarker.java From react-native-amap with MIT License | 5 votes |
private MarkerOptions createMarkerOptions() { MarkerOptions options = new MarkerOptions(); if (anchorIsSet) options.anchor(anchorX, anchorY); //if (calloutAnchorIsSet) options.infoWindowAnchor(calloutAnchorX, calloutAnchorY); options.position(position); options.title(title); options.snippet(snippet); options.rotateAngle(rotation); options.setFlat(flat); options.draggable(draggable); options.zIndex(zIndex); options.alpha(opacity); options.icon(getIcon()); return options; }
Example 3
Source File: CustomMarkerActivity.java From TraceByAmap with MIT License | 4 votes |
/** * 在地图上添加marker */ private void addMarkersToMap() { // 文字显示标注,可以设置显示内容,位置,字体大小颜色,背景色旋转角度 TextOptions textOptions = new TextOptions() .position(Constants.BEIJING) .text("Text") .fontColor(Color.BLACK) .backgroundColor(Color.BLUE) .fontSize(30) .rotate(20) .align(Text.ALIGN_CENTER_HORIZONTAL, Text.ALIGN_CENTER_VERTICAL) .zIndex(1.f).typeface(Typeface.DEFAULT_BOLD); aMap.addText(textOptions); Marker marker = aMap.addMarker(new MarkerOptions() .title("好好学习") .icon(BitmapDescriptorFactory .defaultMarker(BitmapDescriptorFactory.HUE_AZURE)) .draggable(true)); marker.setRotateAngle(90);// 设置marker旋转90度 marker.setPositionByPixels(400, 400); marker.showInfoWindow();// 设置默认显示一个infowinfow markerOption = new MarkerOptions(); markerOption.position(Constants.XIAN); markerOption.title("西安市").snippet("西安市:34.341568, 108.940174"); markerOption.draggable(true); markerOption.icon( // BitmapDescriptorFactory // .fromResource(R.drawable.location_marker) BitmapDescriptorFactory.fromBitmap(BitmapFactory .decodeResource(getResources(), R.drawable.location_marker))); // 将Marker设置为贴地显示,可以双指下拉看效果 markerOption.setFlat(true); ArrayList<BitmapDescriptor> giflist = new ArrayList<BitmapDescriptor>(); giflist.add(BitmapDescriptorFactory .defaultMarker(BitmapDescriptorFactory.HUE_BLUE)); giflist.add(BitmapDescriptorFactory .defaultMarker(BitmapDescriptorFactory.HUE_RED)); giflist.add(BitmapDescriptorFactory .defaultMarker(BitmapDescriptorFactory.HUE_YELLOW)); MarkerOptions markerOption1 = new MarkerOptions().anchor(0.5f, 0.5f) .position(Constants.CHENGDU).title("成都市") .snippet("成都市:30.679879, 104.064855").icons(giflist) .draggable(true).period(10); ArrayList<MarkerOptions> markerOptionlst = new ArrayList<MarkerOptions>(); markerOptionlst.add(markerOption); markerOptionlst.add(markerOption1); List<Marker> markerlst = aMap.addMarkers(markerOptionlst, true); marker2 = markerlst.get(0); marker3 = aMap.addMarker(new MarkerOptions().position( Constants.ZHENGZHOU).icon( BitmapDescriptorFactory.fromResource(R.drawable.ic_launcher))); }